Runge1980 Posted July 27, 2016 Share Posted July 27, 2016 Hi guys. I'm having a returning issue in my shop I just can't figure out... And it's driving me crazy :-( If you have products that uses the color attribute there is no problem. The problem is as following: I have products that come in different lengths and models and need a indication of that for the customers. if you see this page it makes sense: http://techstore.dk/31-hdmi-kabler Here there are some cables in the HDMI category but you can't see that they are available in different lengths. Only when you click on the product you will see the drop-down menu. This is not very user friendly for the customers as they are not made aware of it comes in other lengths. Is there not a feature that supports this in PS? it could be a text in front of the price saying: From /Starts From etc. if the product comes in different lengths. And: More models if it's a item depending on a specific model. Standard PS is doing the indication spot on when the attributes are color. http://techstore.dk/80-iphone-66s-covers Can't be true that i'm the only one with this issue.?? /Lasse Link to comment Share on other sites More sharing options...
rocky Posted July 28, 2016 Share Posted July 28, 2016 You could add code like the following to product-list.tpl: {if $product.id_product_attribute > 0}{l s='More options available'}{/if} Link to comment Share on other sites More sharing options...
Runge1980 Posted July 28, 2016 Author Share Posted July 28, 2016 You could add code like the following to product-list.tpl: {if $product.id_product_attribute > 0}{l s='More options available'}{/if} Ok mate will try that. Could it be possible to do it a bit more specific if you have 2 more attributes beside the color on. I would need the following: when a item is in more lengths (see more lengths) and when a item is model specific (See models) just an example. as it will be in danish :-) /Lasse Link to comment Share on other sites More sharing options...
Runge1980 Posted July 28, 2016 Author Share Posted July 28, 2016 Here is a pic of where it puts the text + a idea of what it should / could look like in example 1+2 Link to comment Share on other sites More sharing options...
rocky Posted July 29, 2016 Share Posted July 29, 2016 You can add something like the following below the {hook h="displayProductPriceBlock" product=$product type="weight"} line in product-list.tpl: {foreach from=Product::getAttributesParams($product.id_product, $product.id_product_attribute) item='attribute'} {if $attribute.id_attribute_group == 1} {l s='More lengths available'} {break} {elseif $attribute.id_attribute_group == 2} {l s='More models available'} {break} {/if} {/foreach} Change 1 to the ID of the Length attribute group and 2 to the ID of the Models attribute group. You can add more if statements as required. Link to comment Share on other sites More sharing options...
Runge1980 Posted July 30, 2016 Author Share Posted July 30, 2016 (edited) You can add something like the following below the {hook h="displayProductPriceBlock" product=$product type="weight"} line in product-list.tpl: {foreach from=Product::getAttributesParams($product.id_product, $product.id_product_attribute) item='attribute'} {if $attribute.id_attribute_group == 1} {l s='More lengths available'} {break} {elseif $attribute.id_attribute_group == 2'} {l s='More models available'} {break} {/if} {/foreach} Change 1 to the ID of the Length attribute group and 2 to the ID of the Models attribute group. You can add more if statements as required. Hmm tried but it diden't do anything on the page I have a theme installed. So i have the following under /public_html/themes - default-bootstrap - pf_nextstore (Bought Theme) - Prestashop Edited July 30, 2016 by Runge1980 (see edit history) Link to comment Share on other sites More sharing options...
rocky Posted July 31, 2016 Share Posted July 31, 2016 It's themes/pf_nextstore/product-list.tpl that you should edit. You can find the attribute group IDs on your Catalog > Product Attributes tab in the Back Office. Link to comment Share on other sites More sharing options...
Runge1980 Posted July 31, 2016 Author Share Posted July 31, 2016 It's themes/pf_nextstore/product-list.tpl that you should edit. You can find the attribute group IDs on your Catalog > Product Attributes tab in the Back Office. {if isset($products) && $products} {*define numbers of product per line in other page for desktop*} {if Configuration::get('PTS_CP_PRODUCTS_ITEMROW')} {assign var='nbItemsPerLine' value=Configuration::get('PTS_CP_PRODUCTS_ITEMROW')} {assign var='nbItemsPerLineTablet' value=Configuration::get('PTS_CP_PRODUCTS_ITEMROW')} {else} {assign var='nbItemsPerLine' value=3} {assign var='nbItemsPerLineTablet' value=3} {/if} {assign var='nbItemsPerLineMobile' value=2} {*define numbers of product per line in other page for tablet*} {assign var='nbLi' value=$products|@count} {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines} {math equation="nbLi/nbItemsPerLineTablet" nbLi=$nbLi nbItemsPerLineTablet=$nbItemsPerLineTablet assign=nbLinesTablet} {math equation="nbLi/nbItemsPerLine" nbLi=12 nbItemsPerLine=$nbItemsPerLine assign=colLap} {math equation="nbLi/nbItemsPerLine" nbLi=12 nbItemsPerLine=$nbItemsPerLineTablet assign=colTablet} {math equation="nbLi/nbItemsPerLine" nbLi=12 nbItemsPerLine=$nbItemsPerLineMobile assign=colMobile} <!-- Products list --> <script type="text/javascript"> var colLap = {$colLap}; var colTablet = {$colTablet}; var colMobile = {$colMobile}; </script> <ul{if isset($id) && $id} id="{$id}"{/if} class="product_list products-block grid row{if isset($class) && $class} {$class}{/if}{if isset($active) && $active == 1} active{/if}"> {foreach from=$products item=product name=products} {math equation="(total%perLine)" total=$smarty.foreach.products.total perLine=$nbItemsPerLine assign=totModulo} {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineTablet assign=totModuloTablet} {math equation="(total%perLineT)" total=$smarty.foreach.products.total perLineT=$nbItemsPerLineMobile assign=totModuloMobile} {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if} {if $totModuloTablet == 0}{assign var='totModuloTablet' value=$nbItemsPerLineTablet}{/if} {if $totModuloMobile == 0}{assign var='totModuloMobile' value=$nbItemsPerLineMobile}{/if} <li class="ajax_block_product col-xs-cus-12 col-xs-6 col-sm-{$colMobile} col-md-{$colTablet} col-lg-{$colLap}{if $smarty.foreach.products.iteration%$nbItemsPerLine == 0} last-in-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLine == 1} first-in-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModulo)} last-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 0} last-item-of-tablet-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineTablet == 1} first-item-of-tablet-line{/if}{if $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 0} last-item-of-mobile-line{elseif $smarty.foreach.products.iteration%$nbItemsPerLineMobile == 1} first-item-of-mobile-line{/if}{if $smarty.foreach.products.iteration > ($smarty.foreach.products.total - $totModuloMobile)} last-mobile-line{/if}" data-col-lg="{$colLap}" data-col-md="{$colTablet}" data-col-sm="{$colMobile}" data-col-xs="6"> {include file="$tpl_dir./sub/product/swap.tpl" product=$product class=''} </li> {/foreach} </ul> {addJsDefL name=min_item}{l s='Please select at least one product' js=1}{/addJsDefL} {addJsDefL name=max_item}{l s='You cannot add more than %d product(s) to the product comparison' sprintf=$comparator_max_item js=1}{/addJsDefL} {addJsDef comparator_max_item=$comparator_max_item} {addJsDef comparedProductsIds=$compared_products} {/if} This is how it looks in the pf_nextstore product-list.tpl file. Any specific place the code should be added? Tried putting it in in the end. that just made some 500 internal errors on the site. Link to comment Share on other sites More sharing options...
rocky Posted July 31, 2016 Share Posted July 31, 2016 That is completely different to the default theme. It seems the products themselves are in themes/pf_nextstore/sub/product/swap.tpl. Link to comment Share on other sites More sharing options...
Runge1980 Posted July 31, 2016 Author Share Posted July 31, 2016 That is completely different to the default theme. It seems the products themselves are in themes/pf_nextstore/sub/product/swap.tpl. So it would be there the code should be imbedded or? Link to comment Share on other sites More sharing options...
rocky Posted July 31, 2016 Share Posted July 31, 2016 Yes, I hope so. It's hard to know, since I'm not familiar with your theme. Link to comment Share on other sites More sharing options...
Runge1980 Posted July 31, 2016 Author Share Posted July 31, 2016 Yes, I hope so. It's hard to know, since I'm not familiar with your theme. ok i will try at ones. I actually tried to contact the company that made the theme with the same post as here and here is what they said: hi, thank for your idea. it is great. but this problem have to hack code, you can contact with prestashop to help. sorry i can't help you thanks Link to comment Share on other sites More sharing options...
Runge1980 Posted July 31, 2016 Author Share Posted July 31, 2016 Still get the 500 internal Link to comment Share on other sites More sharing options...
rocky Posted July 31, 2016 Share Posted July 31, 2016 Sorry, there was a typo in my code. It should be == 2} not == 2'} If you still have problems after fixing that, you can edit config/defines.inc.php and change PS_DEV_MODE from false to true and you'll get an error message instead of a 500 error. Link to comment Share on other sites More sharing options...
Runge1980 Posted July 31, 2016 Author Share Posted July 31, 2016 Hmmm strange... It does not do anything, and have tried it in every folder Link to comment Share on other sites More sharing options...
rocky Posted August 1, 2016 Share Posted August 1, 2016 It's working fine on my PrestaShop v1.6.1.6 test site. Here's what I see: Because the demo products use the "Size" attribute, which has an attribute group ID of 1, all the products say "More lengths available". Link to comment Share on other sites More sharing options...
Runge1980 Posted August 1, 2016 Author Share Posted August 1, 2016 It's working fine on my PrestaShop v1.6.1.6 test site. Here's what I see: screenshot.png Because the demo products use the "Size" attribute, which has an attribute group ID of 1, all the products say "More lengths available". Ok.. where did you put the code? In bootstrap => produkt-list.tpl ? Should I get in touch with the ones that made the theme. Link to comment Share on other sites More sharing options...
rocky Posted August 1, 2016 Share Posted August 1, 2016 Yes, it was themes/default-bootstrap/product-list.tpl where I put the code. You can try to get in touch with your theme developer, though they may not be willing to adapt the modification to their theme. Link to comment Share on other sites More sharing options...
Runge1980 Posted August 1, 2016 Author Share Posted August 1, 2016 Yes, it was themes/default-bootstrap/product-list.tpl where I put the code. You can try to get in touch with your theme developer, though they may not be willing to adapt the modification to their theme. Ok Alternativ is there a module that supports this Link to comment Share on other sites More sharing options...
rocky Posted August 2, 2016 Share Posted August 2, 2016 It would be possible to write a module to do it. The module would need to have a function like this: public function hookDisplayProductPriceBlock($params) { if ($params['type'] == 'weight') { foreach (Product::getAttributesParams($params['product']['id_product'], $params['product']['id_product_attribute') as $attribute) { if ($attribute['id_attribute_group'] == 1) { return '<p>'.$this->l('More lengths available').'</p>'; } elseif ($attribute['id_attribute_group'] == 2) { return '<p>'.$this->l('More models available').'</p>'; } } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now