THELIA Forum

Welcome to the THELIA support and discusssion forum

Announcement

Rejoignez la communauté sur le Discord Thelia : https://discord.gg/YgwpYEE3y3

Offline

#1 loop product

(02-09-2014 10:02:17)


Bonjour,

je ne comprends pas dans la boucle product les parametres suivant :
feature_availability     

A list of mandatory features and the feature_availability expected for these.
example : feature_availability="1: (1 | 2) , 2:*, 3: 10 | (11&12)" : feature 1 must have feature_availability 1 or 2 AND feature 2 must be set to any feature_availability AND feature 3 must have feature_availability 10 or both feature_availability 11 and 12


feature_values     

A list of mandatory features and the string value expected for these.
example : feature_availability="1: (foo | bar) , 2:*, 3: foobar" : feature 1 must have feature value "foo" or "bar" AND feature 2 must be set to any feature_availability AND feature 3 must have feature value "foobar"


exemple: j'ai une chaise avec une caracteristique couleur rouge
la caracteristique couleur a l'id =1
et la valeur rouge l'id=1

avec les 2 paramatres precedent je peux filtrer cette caracteristique ?

en ecrivant

{loop type="product" name="product_list" feature_value="1:rouge"}
....
{/loop}

Last edited by zzuutt (02-09-2014 10:07:14)

Offline

#2 Re: loop product

(03-09-2014 08:08:20)


si je mets ces parametres

{assign var="amount" value="{count type="product" feature_values="1:(rouge)"}"}

j'ai l'erreur suivante

PropelException: Unable to execute COUNT statement [SELECT COUNT(*) FROM (SELECT product.ID, product.TAX_RULE_ID, product.REF, product.VISIBLE, product.POSITION, product.TEMPLATE_ID, product.BRAND_ID, product.CREATED_AT, product.UPDATED_AT, product.VERSION, product.VERSION_CREATED_AT, product.VERSION_CREATED_BY, ROUND(CASE WHEN `pse`.PROMO=1 THEN `price`.PROMO_PRICE ELSE `price`.PRICE END, 2) AS real_price, `price`.PRICE AS price, `price`.PROMO_PRICE AS promo_price, NOT ISNULL(`requested_locale_i18n`.`ID`) AS IS_TRANSLATED, CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`TITLE` ELSE `default_locale_i18n`.`TITLE` END AS i18n_TITLE, CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`CHAPO` ELSE `default_locale_i18n`.`CHAPO` END AS i18n_CHAPO, CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`DESCRIPTION` ELSE `default_locale_i18n`.`DESCRIPTION` END AS i18n_DESCRIPTION, CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`POSTSCRIPTUM` ELSE `default_locale_i18n`.`POSTSCRIPTUM` END AS i18n_POSTSCRIPTUM, CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`META_TITLE` ELSE `default_locale_i18n`.`META_TITLE` END AS i18n_META_TITLE, CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`META_DESCRIPTION` ELSE `default_locale_i18n`.`META_DESCRIPTION` END AS i18n_META_DESCRIPTION, CASE WHEN NOT ISNULL(`requested_locale_i18n`.ID) THEN `requested_locale_i18n`.`META_KEYWORDS` ELSE `default_locale_i18n`.`META_KEYWORDS` END AS i18n_META_KEYWORDS, `pse`.ID AS pse_id, `pse`.NEWNESS AS is_new, `pse`.PROMO AS is_promo, `pse`.QUANTITY AS quantity, `pse`.WEIGHT AS weight, `pse`.EAN_CODE AS ean_code, COUNT(`pse_count`.ID) AS pse_count FROM `product` 
INNER JOIN `product_sale_elements` `pse` ON (product.ID=pse.PRODUCT_ID AND `pse`.IS_DEFAULT=1) 
INNER JOIN `product_sale_elements` `pse_count` ON (product.ID=pse_count.PRODUCT_ID) 
LEFT JOIN `product_price` `price` ON (pse.ID=price.PRODUCT_SALE_ELEMENTS_ID AND `price`.`currency_id` = :p1) 
LEFT JOIN `product_i18n` `default_locale_i18n` ON (product.ID=default_locale_i18n.ID AND `default_locale_i18n`.LOCALE = :p2) 
LEFT JOIN `product_i18n` `requested_locale_i18n` ON (product.ID=requested_locale_i18n.ID AND `requested_locale_i18n`.LOCALE = :p3) 
LEFT JOIN `feature_product` `fv_1_rouge` ON ((product.ID=fv_1_rouge.PRODUCT_ID AND `fv_1_rouge`.FEATURE_ID = :p4) AND `fv_1_rouge`.BY_DEFAULT = :p5) WHERE ((NOT ISNULL(`requested_locale_i18n`.ID) OR NOT ISNULL(`default_locale_i18n`.ID)) AND ((NOT ISNULL(`fv_1_rouge`.ID)))) AND product.VISIBLE=:p6 GROUP BY product.ID) propelmatch4cnt]

j'ai un seul produit qui a une feature = rouge
voici la table feature_product
1409727990-03-09-2014-09-02-10.jpg

je ne comprends pas mon erreur

Offline

#3 Re: loop product

(03-09-2014 08:37:36)


Il y a une autre erreur (la source), qui donne la raison de l'échec. On peut la voir ?


OpenStudio Toulouse

Offline

#4 Re: loop product

(03-09-2014 09:00:16)


    in D:\wamp\www\thelia_2.0.3\core\vendor\propel\propel\src\Propel\Runtime\ActiveQuery\Criteria.php line 2324
    at Criteria->doCount(object(ConnectionWrapper)) in D:\wamp\www\thelia_2.0.3\core\vendor\propel\propel\src\Propel\Runtime\ActiveQuery\ModelCriteria.php line 1246
    at ModelCriteria->doCount(object(ConnectionWrapper)) in D:\wamp\www\thelia_2.0.3\core\vendor\propel\propel\src\Propel\Runtime\ActiveQuery\ModelCriteria.php line 1226
    at ModelCriteria->count(null) in D:\wamp\www\thelia_2.0.3\core\vendor\propel\propel\src\Propel\Runtime\Util\PropelModelPager.php line 103
    at PropelModelPager->init(null) in D:\wamp\www\thelia_2.0.3\core\vendor\propel\propel\src\Propel\Runtime\ActiveQuery\ModelCriteria.php line 1265
    at ModelCriteria->paginate('1', '8') in D:\wamp\www\thelia_2.0.3\core\lib\Thelia\Core\Template\Element\BaseLoop.php line 369
    at BaseLoop->searchWithPagination(object(ProductQuery), null) in D:\wamp\www\thelia_2.0.3\core\lib\Thelia\Core\Template\Element\BaseLoop.php line 305
    at BaseLoop->search(object(ProductQuery), null) in D:\wamp\www\thelia_2.0.3\core\lib\Thelia\Core\Template\Element\BaseLoop.php line 423
    at BaseLoop->exec(null) in D:\wamp\www\thelia_2.0.3\core\lib\Thelia\Core\Template\Smarty\Plugins\TheliaLoop.php line 144
    at TheliaLoop->theliaLoop(array('type' => 'product', 'name' => 'product_list', 'feature_values' => '1:(rouge)', 'limit' => '8', 'page' => '1', 'order' => 'alpha'), null, object(Smarty_Internal_Template), true) in D:\wamp\www\thelia_2.0.3\cache\dev\smarty\compile\96b3878e0c93847c9a1a80a1d67eef33753c1da9.file.search.html.php line 446
    at content_5406bec53beeb9_45354176(object(Smarty_Internal_Template)) in D:\wamp\www\thelia_2.0.3\core\vendor\smarty\smarty\libs\sysplugins\smarty_internal_templatebase.php line 180
    at Smarty_Internal_TemplateBase->fetch('file:search.html') in D:\wamp\www\thelia_2.0.3\core\lib\Thelia\Core\Template\Smarty\SmartyParser.php line 332
    at SmartyParser->internalRenderer('file', 'search.html', array()) in D:\wamp\www\thelia_2.0.3\core\lib\Thelia\Core\Template\Smarty\SmartyParser.php line 348
    at SmartyParser->render('search.html') in D:\wamp\www\thelia_2.0.3\core\lib\Thelia\Core\EventListener\ViewListener.php line 73
    at ViewListener->onKernelView(object(GetResponseForControllerResultEvent))
    at call_user_func(array(object(ViewListener), 'onKernelView'), object(GetResponseForControllerResultEvent)) in D:\wamp\www\thelia_2.0.3\core\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php line 164
    at EventDispatcher->doDispatch(array(array(object(ViewListener), 'beforeKernelView'), array(object(ViewListener), 'onKernelView')), 'kernel.view', object(GetResponseForControllerResultEvent)) in D:\wamp\www\thelia_2.0.3\core\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php line 53
    at EventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in D:\wamp\www\thelia_2.0.3\core\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher.php line 167
    at ContainerAwareEventDispatcher->dispatch('kernel.view', object(GetResponseForControllerResultEvent)) in D:\wamp\www\thelia_2.0.3\core\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpKernel.php line 134
    at HttpKernel->handleRaw(object(Request), '1') in D:\wamp\www\thelia_2.0.3\core\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpKernel.php line 73
    at HttpKernel->handle(object(Request), '1', true) in D:\wamp\www\thelia_2.0.3\core\lib\Thelia\Core\TheliaHttpKernel.php line 81
    at TheliaHttpKernel->handle(object(Request), '1', true) in D:\wamp\www\thelia_2.0.3\core\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\Kernel.php line 197
    at Kernel->handle(object(Request)) in D:\wamp\www\thelia_2.0.3\web\index_dev.php line 36

Offline

#5 Re: loop product

(03-09-2014 11:14:56)


j'utilise le script par defaut search.html
ou j'ai remplace la ligne

{assign var="amount" value="{count type="product" title="{$smarty.get.q}"}"}

par

{assign var="amount" value="{count type="product" feature_values="1:(rouge)"}"}

Offline

#6 Re: loop product

(02-10-2014 10:49:04)


Bonjour,

Même problème rencontré visiblement à la même ligne :
{assign var="amount" value="{count type="product" title="{$smarty.get.q}"}"}

Une solution a été trouvée ?...

Merci

Offline

#7 Re: loop product

(02-10-2014 11:09:13)


je n'ai pas trouve le pb, je continue a chercher.....(de temps en temps...pas trop de temps........) .
j'ai contourne en utilisant une autre solution qui ne repond qu'en partie
cela ne me convient pas mais faute d'autre chose.....

Offline

#8 Re: loop product

(02-10-2014 11:39:24)


Dans ton cas : feature_values="1:1"

1:1, ça veut dire: la feature ID=1, et la feature availability (= caractéristique choisie dans une liste) ID=1

1:rouge, ça veut dire la feature ID=1 avec la feature value (= caractéristique a texte libre) rouge

Feature availability, c'est une traduction à la machette du terme Thelia 1 "caractéristique disponible", et ça ne veut pas dire grand chose. Feature value, ça se comprend. Mais bon, quelque chose comme Feature list item / Feature text value aurait été plus compréhensible.


OpenStudio Toulouse

Offline

#9 Re: loop product

(02-10-2014 12:19:30)


oups
je viens de regarder mon script, j'avais bien fini par trouver apparemment, a force de faire de tout........ et peut etre un peu d'alzheimer tongue

voici ma boucle:

{$featureResultSearch=""}
{loop name="features" type="feature"}
  {$featureResult=""}
  {loop name="feature-availability" type="feature-availability" feature="$ID"}
    {if {$TITLE|lower}=={$keysearch|lower}}
      {$featureResult = $ID}
    {/if}
  {/loop}
  {if $featureResult != ""}
    {$featureResultSearch = "{$ID}:{$featureResult}"}
  {/if}
 {/loop}
......
{loop type="product" name="product_list" feature_availability=$featureResultSearch limit=$limit page=$product_page order=$product_order}
..............
{/loop}