tumil Posted July 20, 2017 Share Posted July 20, 2017 (edited) Hi, I need the value of group reduction to be shown somewhere on the product-list.tpl I managed to do it on product.tpl by simply adding a {$group_reduction} But here this code doesn't do the trick. How can I achieve that? I tried something like {&group-reduction} and other variations but either nothing shows up or only "0" I'll be grateful for any help Edited July 28, 2017 by tumil (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted July 20, 2017 Share Posted July 20, 2017 I might be wrong but I don't think it's set in the product list.You will need an override, for product.php, getProductProperties method.At the end, before$row = Product::getTaxesInformations($row, $context); assign the reduction $idGroup = (int) Group::getCurrent()->id; $groupReduction = GroupReduction::getValueForProduct($row['id_product'], $idGroup); 1 Link to comment Share on other sites More sharing options...
tumil Posted July 21, 2017 Author Share Posted July 21, 2017 I added these two lines before $row = Product::getTaxesInformations($row, $context); in classes/Product.php but the group reduction still doesn't show up when I use {$groupReduction} or {$group_reduction}. Unless I did something wrong? Link to comment Share on other sites More sharing options...
NemoPS Posted July 22, 2017 Share Posted July 22, 2017 My fault, add this instead of $groupReduction$row['groupReduction] = ...whatever it was 2 Link to comment Share on other sites More sharing options...
tumil Posted July 22, 2017 Author Share Posted July 22, 2017 Ok, added. And now how I'm supposed to show these reductions? {$groupReduction} or {$group_reduction} still do not work Link to comment Share on other sites More sharing options...
NemoPS Posted July 24, 2017 Share Posted July 24, 2017 For each product it's $product['groupReduction'] 1 Link to comment Share on other sites More sharing options...
tumil Posted July 24, 2017 Author Share Posted July 24, 2017 Unfortunately, all I get is "ARRAY" instead of some "0.200" or so... :/ Link to comment Share on other sites More sharing options...
tumil Posted July 26, 2017 Author Share Posted July 26, 2017 With the first product on list I get: "Notice: Array to string conversion in "/home/users/sabipol/public_html/sklep3/cache/smarty/compile/cc/cb/97/cccb97a68a3e546a0a61f1e2eb4c790a3330d5aa.file.product-list.tpl.php" on line 309 Array" With the others... just "Array" Link to comment Share on other sites More sharing options...
NemoPS Posted July 26, 2017 Share Posted July 26, 2017 {$product.groupReduction|@debug_print_var}See what it is 1 Link to comment Share on other sites More sharing options...
tumil Posted July 26, 2017 Author Share Posted July 26, 2017 So, I'll just paste all I have got from it for one of the products: Array (84) id_product => "4268" id_supplier => "2" id_manufacturer => "41" id_category_default => "335" id_shop_default => "1" id_tax_rules_group => "5" on_sale => "0" online_only => "0" ean13 => "8593403771773" upc => null ecotax => "0.000000" quantity => 265 minimal_quantity => "1" price => 95 wholesale_price => "77.235700" unity => null unit_price_ratio => "0.000000" additional_shipping_cost => "0.00" reference => "771773" supplier_reference => "" location => null width => "0.000000" height => "0.000000" depth => "0.000000" weight => "0.000000" out_of_stock => "2" quantity_discount => "0" customizable => "0" uploadable_files => "0" text_fields => "0" active => "1" redirect_type => "" id_product_redirected => "0" available_for_order => "1" available_date => "2010-01-01" condition => "new" show_price => "1" indexed => "1" visibility => "both" cache_is_pack => "0" cache_has_attachments => "0" is_virtual => "0" cache_default_attribute => null date_add => "2017-07-24 06:28:38" date_upd => "2017-07-26 12:30:49" advanced_stock_management => "0" pack_stock_type => "3" emo_paczka => "2b4c224ca62ed7f8b966950ff6269390" emo_source => "0" id_shop => "1" id_lang => "1" description => "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HT..." description_short => "BOHEMIA POLAND zajmuje się importem n..." link_rewrite => "bohemia-poland-patera-na-nodze-trojkatna" meta_description => "BOHEMIA POLAND PATERA NA NODZE TRÓJKĄ..." meta_keywords => "BOHEMIA,POLAND,PATERA,NA,NODZE,TRÓJKĄ..." meta_title => "BOHEMIA POLAND PATERA NA NODZE TRÓJKĄ..." name => "BOHEMIA POLAND PATERA NA NODZE TRÓJKĄ..." available_now => "" available_later => "" id_image => "4268-8805" legend => "BOHEMIA POLAND PATERA NA NODZE TRÓJKĄ..." manufacturer_name => "BOHEMIA POLAND" id_product_attribute => 0 new => "1" product_attribute_minimal_quantity => null allow_oosp => 0 category => "triangle" link => "http://sabipolsklep.pl/triangle/4268-..." attribute_price => 0 price_tax_exc => 77.2357 price_without_reduction => 94.999911 reduction => 0 specific_prices => Array (0) quantity_all_versions => 265 features => Array (0) attachments => Array (0) virtual => 0 pack => 0 packItems => Array (0) nopackprice => 0 customization_required => false rate => 23 tax_name => "PTU PL 23%" BOHEMIA POLAND PATERA NA NODZE TRÓJKĄTNA Link to comment Share on other sites More sharing options...
NemoPS Posted July 28, 2017 Share Posted July 28, 2017 Indeed, it's not there.Can you post the few lines of code where you assigned it? 1 Link to comment Share on other sites More sharing options...
tumil Posted July 28, 2017 Author Share Posted July 28, 2017 Now I see... I have changed the line with taxes instead the one with group reductions when I was applying your correction with the $row['groupReduction] instead of $groupReduction haha It all works just as I wanted! Huge thanks, NemoPS! To be honest, I didn't expect that anyone would help me with that kind of problem Thanks! 1 Link to comment Share on other sites More sharing options...
lumondes Posted August 13, 2018 Share Posted August 13, 2018 Hi, this works on PS 1.7? I'm trying with no results.... Link to comment Share on other sites More sharing options...
tumil Posted September 11, 2018 Author Share Posted September 11, 2018 Yup, it works. Just checked it. Try to clear the cache or - if you're making an override in the override folder - make sure you have the override option checked in Advanced>Performance 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