Change Price Display Order

  • Posts: 55
  • Thank you received: 0
12 years 4 months ago #56660

I've altered product listing_img_title to display the price on the product listing page. No problem with that, except that the products that have two prices (eg Prime Rib Sliders: 3.25 for one/14.95 for six) are showing the wrong way round, with the price for 6 first. I want it to show price for one followed by price for six.

I've tried altering product listing_price - namely this section here:

echo '</span> ';
if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
if($price->price_min_quantity>1){
echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
}else{
echo JText::_('PER_UNIT');
}
}

But my knowledge of PHP is not good enough to know what I should be doing here. I'm sure it must be incredibly simple - could you point me in the right direction?

Thanks, Jen

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 4 months ago #56716

$this->row->prices = array_reverse($this->row->prices);

You can try to add that line near the beginning of the file in order to revert the prices.
However, the prices should be ordered properly by default.
Please note that the text says: XXX PER unit for at least YYY units bought.
You need to enter the unit price in the prices area of the product and not the price for 6 units.
That's usually why the system displays the prices in what seems to be the wrong order.

Please Log in or Create an account to join the conversation.

  • Posts: 55
  • Thank you received: 0
12 years 4 months ago #56751

Ok, thanks. I am attempting to show the total price for 1 and the total price for 6; I don't want the price-per-unit for 6. Currently I've set the prices as variants to get round this ordering issue, I'll try the method you suggested.

A related question: when using this method, is there any way to have the text "each" only after products for which there is more than one quantity option available? To clarify - for example, I want my menu item "Prime Rib Sliders" to display "$3.25 each (or) $14.95 for six"; I want my item "Potato Skins" (which has only one price) to just display "4.95", without the "each".

Thanks again for your support :)

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
12 years 4 months ago #56808

Please Log in or Create an account to join the conversation.

  • Posts: 55
  • Thank you received: 0
12 years 4 months ago #56828

OK, thanks.

Please Log in or Create an account to join the conversation.

Time to create page: 0.062 seconds
Powered by Kunena Forum