Volume Price Range

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #78084

Hi, I am using the Business and am wondering about displaying volume price ranges.

I have attached an image to explain:

Can I get the price ranges to display as:

AUD5.00 1 to 5
AUD3.00 6 to 9
AUD2.00 10 to 99
AUD0.95 100 to 999
AUD0.25 9999 +

Instead of:

AUD5.00 each
AUD3.00 per unit for buying at least 9
AUD2.00 per unit for buying at least 99
AUD0.95 per unit for buying at least 999

Thanks in advance (Great product BTY)


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #78100

Hi,

Yes it's possible, you have to replace the lines:

			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');
				}
			}
By:
			if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
				$nextMin = $k + 1;
				if($price->price_min_quantity>1){
					if(isset($this->row->prices[$nextMin]))
						$price->price_max_quantity = $this->row->prices[$nextMin]->price_min_quantity;
					else
						$price->price_max_quantity = '999';

					echo $price->price_min_quantity." to ".$price->price_max_quantity;

					//echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
				}else{
					if(isset($this->row->prices[$nextMin])){
						$price->price_max_quantity = $this->row->prices[$nextMin]->price_min_quantity;
						echo "1 to ".$price->price_max_quantity;
					}else
						echo JText::_('PER_UNIT');
				}
			}
And replace the foreach: "foreach($this->row->prices as $price){" by "foreach($this->row->prices as $k => $price){"

In the view "product / listing_price" in HikaShop > Display > Views

The following user(s) said Thank You: sambob

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #78103

Hi Xavier,

thanks for that. Greatly appreciated.

Am i right in guessing the $price->price_max_quantity = '999'; will be standard across all products?

Is there a way to have that set to 1+ to whatever the last increment is?

See attachement:



In that example... the last one is 999, but what is I wanted the last one to be 500? (would that code render the last one as 999?)


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #78118

In the code given, the value 999 is to set the max product quantity, I think that it's better to replace it by "..." or just display

echo "From ".$price->price_min_quantity;

The following user(s) said Thank You: sambob

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #78243

Brilliant... it works.

I changed the 999 to a ~

But.. Is there a way to code it so that if there is no higher price increment, the echo could return the following

echo $price->price_min_quantity." + "

Thereby rendering
AUD5.00 1 to 9
AUD3.00 10 to 99
AUD2.00 99 to 999
AUD0.95 999+

Not a coder, but can you have two echos, with the second one being used if the first condition is not met?


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'

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

  • Posts: 26032
  • Thank you received: 4006
  • MODERATOR
11 years 5 months ago #78265

Hi,

			if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){
				$nextMin = $k + 1;
				if($price->price_min_quantity>1){
					if(isset($this->row->prices[$nextMin])) {
						echo $price->price_min_quantity." to ".$this->row->prices[$nextMin]->price_min_quantity;
					} else {
						echo $price->price_min_quantity."+";
					}
				}else{
					if(isset($this->row->prices[$nextMin])){
						$price->price_max_quantity = $this->row->prices[$nextMin]->price_min_quantity;
						echo "1 to ".$price->price_max_quantity;
					}else
						echo JText::_('PER_UNIT');
				}
			}

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: sambob

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #78293

Bingo

Thanks Jerome, (appreciated)

Is there a way not to have AUD0.95 750+ at the cat display level? (see image)




Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #78310

Hi,

Yes it's possible, you just have to disable the option "Display price" in HikaShop > Display > Content menus or modules configuration.

The following user(s) said Thank You: sambob

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #78315

Thanks Xavier & Jerome,

A Great help (as always with Hikashop)

There are a few other things I am trying to do with this tier pricing but I will give it a go and see how I get on before posting the Q.


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #78509

Hi Xavier & Jerome,

ok... I have tried to achieve something by coding myself but cannot work it out.



In the attached image you will see the ranges are:
1 to 10
10 to 100
100+

Which is almost right... but there is an overlap 10 and 100

Is it possible to get it to display:
1 to 10
11 to 100
101+

i.e. The next increment up adds 1 to the next increment.


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Attachments:

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

  • Posts: 26032
  • Thank you received: 4006
  • MODERATOR
11 years 5 months ago #78519

Hi

echo ($price->price_min_quantity+1)."+";


Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: sambob

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #78606

Brilliant Jerome!

Thanks you so much.


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #80331

Hi again Jerome & Xavier,

I am now trying to get this volume pricing to work on the Product Table display:



I hunted around for similar code in listing_table, but could not find it.

Which view do I need to edit?


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #80401

Hi,

This is the same view which is used for the listing or the product page "product / listing_price".

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #80514

Morning Xavier,

There are displaying differently:

Here is the link to the Ferrite Disc 5x3 (the one highlighted in the image provided)
geneva.directrouter.com/~magnetgr/index....discs-5x3&Itemid=230


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'
Attachments:
Last edit: 11 years 5 months ago by sambob.

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

  • Posts: 81677
  • Thank you received: 13102
  • MODERATOR
11 years 5 months ago #80576

I confirm that the same product/listing_price file is used for both the table listing and the product page.

If you don't get the same display, I can only think that it comes from a variable in the code of that listing_price file which is not the same on both pages.

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #80581

Hi Nicolas,

Thanks for your reply.

If I remove the custom code (as given) from the listing_price file, they both display correctly.

But using the code that was supplied, means they display differently (as you correctly say)

Any idea what is missing from the code that is not adjusting the table display prices correctly?


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'

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

  • Posts: 81677
  • Thank you received: 13102
  • MODERATOR
11 years 5 months ago #80605

I would say that it comes from that code:
if(isset($price->price_min_quantity) && empty($this->cart_product_price) && $this->params->get('per_unit',1)){

try to have that instead:
if(isset($price->price_min_quantity) && empty($this->cart_product_price)){

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

  • Posts: 260
  • Thank you received: 25
11 years 5 months ago #80615

Hi Nicolas,

that gives a Parse error: syntax error, unexpected '-', expecting ',' or ')'


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'

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

  • Posts: 13201
  • Thank you received: 2322
11 years 5 months ago #80643

Hi,

I think that you forgot a ")" in the line or something else.

The following user(s) said Thank You: sambob

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

Time to create page: 0.146 seconds
Powered by Kunena Forum