Discount on packs of items

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77491

The best way to explain is show an actual product:

www.uk-leds.com/product/28-led-smiley-face.html

I'd want the:

£ 12.00 each
£ 10.00 per unit for buying at least 2
£ 9.00 per unit for buying at least 3
£ 8.00 per unit for buying at least 4
£ 7.00 per unit for buying at least 5
£ 6.00 per unit for buying at least 6

To change the

£ 12.00 each
£ 10.00 per pack for buying at least 2
£ 9.00 per pack for buying at least 3
£ 8.00 per pack for buying at least 4
£ 7.00 per pack for buying at least 5
£ 6.00 per pack for buying at least 6


However i just want this for this individual product.

Thanks


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)

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

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

Hi,

You can override the translation in HikaShop > Configuration > languages. Edit your language file, find the text to translate and replace it.
www.hikashop.com/en/support/documentation/faq.html#translation

To have it only on this product, you should create a new translation in the language file, and edit the file "hikashop_price.php" in the folder "plugins/content/hikashop_price".
Try to replace the line:

							echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
By:
						if($this->row->product_id == 0)
							echo JText::sprintf('PER_PACK_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
						else
							echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);

Replace 0 by the id of your product.

Last edit: 11 years 11 months ago by Xavier.
The following user(s) said Thank You: tjharvey

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

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77494

Xavier wrote: Hi,

You can override the translation in HikaShop > Configuration > languages. Edit your language file, find the text to translate and replace it.
www.hikashop.com/en/support/documentation/faq.html#translation


How would i do for just an individual item?


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)

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

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

Sorry, I forgot the line "How would i do for just an individual item?" ^^ The answer is in the previous post.

The following user(s) said Thank You: tjharvey

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

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77508

That's fine, however:

gyazo.com/758689a45bd027e63f047ca412690afd

Is all i can see..

Oh and congratulations on 250 thank you's :)


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)

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

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

Thanks :)

And the view to edit is "product / listing_price", replace the line:

echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
By:
if(hikashop_getCID() == 0)
	echo JText::sprintf('PER_PACK_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
else
	echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);

To edit a view go in HikaShop > Display > Views

Last edit: 11 years 11 months ago by Xavier.
The following user(s) said Thank You: tjharvey

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

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77525

You keep editing it after i've read it! One second let me try and test.

www.uk-leds.com/product/28-led-smiley-face.html

It changed the text, however it's wrong :(


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)
Last edit: 11 years 11 months ago by tjharvey.

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

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
11 years 11 months ago #77549

Hi,

You have to change the value in the "if" section. Your product id is not "0" but it seams to be "28" regarding your URL.

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

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

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77552

if(hikashop_getCID() == 28)
echo JText::sprintf('PER_PACK_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
else
echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);


That's what i've got no fix :(


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)

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

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
11 years 11 months ago #77571

Hi,

Are you sure ?
Because I see the text "PER_PACK_AT_LEAST_X_BOUGHT" in your product page.
You just have to add the new translation :)

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

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

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77691

Hi Jerome,

How would i add the new translation? Also if i wanted to do this on numerous products how would i do this?

Thanks.


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)

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

  • Posts: 26152
  • Thank you received: 4027
  • MODERATOR
11 years 11 months ago #77693

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

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

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77696

Hi Jerome,

gyazo.com/d2af786b09636c5120c71e6bd81827b4

Is what i get, would i be able to modify the english to get this to work?


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)

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

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

Yes you have to click on the change button. And then add: PER_PACK_AT_LEAST_X_BOUGHT="per pack for buying at least %s"

The following user(s) said Thank You: tjharvey

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

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77702

Brilliant that works now.
Also if i wanted to do this on numerous products how would i do this?

However i'd like (on that page again) for the £12.00 each to be £12 per pack

How would i do this? (hopefully i'll pickup how to modify all of this and i won't bother you with this again) :P


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)
Last edit: 11 years 11 months ago by tjharvey.

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

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

To have many products, you can do something like:

$productsPack = array("28", "29");
if(in_array(hikashop_getCID(),$productsPack)
    echo JText::sprintf('PER_PACK_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
else
    echo JText::sprintf('PER_UNIT_AT_LEAST_X_BOUGHT',$price->price_min_quantity);
And add values in the array.

To change the text for "each", you can do the same thing but instead of the previous line to edit, the line is:
echo JText::_('PER_UNIT');

You should have something like:
$productsPack = array("28", "29");
if(in_array(hikashop_getCID(),$productsPack)
    echo JText::_('PER_PACK');
else
    echo JText::_('PER_UNIT');

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

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77748

Well i can safely say that it broke my site :P


" echo JText::sprintf('PER_PACK_AT_LEAST_X_BOUGHT',$price->price_min_quantity); " is the line

"Parse error: syntax error, unexpected T_ECHO in /homepages/44/d380373488/htdocs/uk-leds/templates/beez_20/html/com_hikashop/product/listing_price.php on line 131 " is the error.


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)
Last edit: 11 years 11 months ago by tjharvey.

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

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

You can delete the override of the view to have your site back ;)

The following user(s) said Thank You: tjharvey

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

  • Posts: 206
  • Thank you received: 26
11 years 11 months ago #77752

How?


I'm not an expert at this, if i post on your thread i'm doing so with the best of my knowledge and just trying to help :)

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

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

In the backend, HikaShop > Display > Views, click on the dustbin next to the view "product / listing_price". You will lost all your changes, you can copy the content before deleting it.

The following user(s) said Thank You: tjharvey

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

Time to create page: 0.101 seconds
Powered by Kunena Forum