Bug on ItemPrice
Posted: 11 Jun 2021, 12:34
Hi
Every things was ok until I change some code for having a good sort by category on catalog (I will post my change later) . I try to go back on my modifications without succes.
When I display Item for public (not registered) I don't want to display prices. (I select Display Price (Access Levels) REGISTERED in Catalog Options)
Now I've got errors on components/com_phocacart/layouts/product_price.php because PriceItem doesn't exist so I add a test each time $d['priceitems'] is used :
$displayPrice = 1;// At start display price = yes. If there will be some condition which will hide the price then use the information e.g. for discount prices (even disable them)
if (isset($d['priceitems']))
{
if ($d['priceitems']['netto'] && $d['priceitems']['taxcalc'] > 0 && ($d['priceitems']['netto'] != $d['priceitems']['brutto'])) {
$labelNetto = '<div class="ph-price-txt ph-price-netto-txt '.$classPS.'-txt">'. $d['priceitems']['nettotxt'].'</div>';
$priceNetto = '<div class="ph-price-netto '.$classPS.'">'.$d['priceitems']['nettoformat'].'</div>';
}
....
With that patch the display is ok but I dont understand why, now, I need that kind of patch ...
At this time I do not understand how the $displayData variable is entered... this may be the key to the problem.
Every things was ok until I change some code for having a good sort by category on catalog (I will post my change later) . I try to go back on my modifications without succes.
When I display Item for public (not registered) I don't want to display prices. (I select Display Price (Access Levels) REGISTERED in Catalog Options)
Now I've got errors on components/com_phocacart/layouts/product_price.php because PriceItem doesn't exist so I add a test each time $d['priceitems'] is used :
$displayPrice = 1;// At start display price = yes. If there will be some condition which will hide the price then use the information e.g. for discount prices (even disable them)
if (isset($d['priceitems']))
{
if ($d['priceitems']['netto'] && $d['priceitems']['taxcalc'] > 0 && ($d['priceitems']['netto'] != $d['priceitems']['brutto'])) {
$labelNetto = '<div class="ph-price-txt ph-price-netto-txt '.$classPS.'-txt">'. $d['priceitems']['nettotxt'].'</div>';
$priceNetto = '<div class="ph-price-netto '.$classPS.'">'.$d['priceitems']['nettoformat'].'</div>';
}
....
With that patch the display is ok but I dont understand why, now, I need that kind of patch ...
At this time I do not understand how the $displayData variable is entered... this may be the key to the problem.