Jump to content

[SOLVED] Get Group Reduction value in product-list.tpl


tumil

Recommended Posts

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 by tumil (see edit history)
Link to comment
Share on other sites

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);
  • Like 1
Link to comment
Share on other sites

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

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

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

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 :D

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!

  • Like 1
Link to comment
Share on other sites

  • 1 year later...
  • 4 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...