开发者

Showing Up of Product Options on Products List

how to show product options on product list in xcart 4.4.2.Under the Men's Clothes category, in shirts, I need to show options like color,size on shirts list itself.Now currently it is in shirt details page.Can anybody help me pleas开发者_StackOverflow中文版e.


You can try this solution. This will display all options values for each products in categories specified by category IDs in array(246, 247) in the condition. You should replace it with your own category IDs (home.php?cat=XXX, XXX - it's a category ID)

Patch for products.php

@@ -133,6 +133,14 @@

 }

+if (isset($cat) && in_array($cat, array(246, 247)) && isset($products) && !empty($active_modules['Product_Options'])) {
+    foreach ($products as $k => $v) {
+        if ('Y' == $v['is_product_options']) {
+            $products[$k]['options'] = func_get_product_classes($v['productid']);
+        }
+    }
+}
+
 $smarty->assign('cat_products',      isset($products) ? $products : array());
 $smarty->assign('navigation_script', "home.php?cat=$cat&sort=$sort&sort_direction=$sort_direction");
 ?>

Patch for skin/common_files/customer/main/products_list.tpl

@@ -45,6 +45,10 @@

         <div class="descr">{$product.descr}</div>

+          {if $active_modules.Product_Options ne ""}
+            {include file="modules/Product_Options/show_options.tpl" product_options=$product.options}
+          {/if}
+
         {if $product.rating_data}
           {include file="modules/Customer_Reviews/vote_bar.tpl" rating=$product.rating_data productid=$product.productid}
         {/if}

skin/common_files/modules/Product_Options/show_options.tpl

{if $product_options ne ''}
<br />
  {foreach from=$product_options item=v}
    {if $v.options ne ''}
       {$v.class|escape}:
       {foreach from=$v.options item=o}
           {$o.option_name|escape},
       {/foreach}
    {/if}
  <br />
  {/foreach}
{/if}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜