Checkout message if particular product is selected

  • Posts: 139
  • Thank you received: 1
10 years 9 months ago #172029

-- HikaShop version -- : 2.3.2 (Business)
-- Joomla version -- : J3.3.3

Is it possible to add a message to the checkout but only if a certain product is purchased?

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

  • Posts: 13201
  • Thank you received: 2322
10 years 9 months ago #172056

Hi,

Yes, you can edit the view "checkout / cart" for example, then add some php to check if the desired product is in the cart and display a message thanks to this kind of code:

<?php
$app = JFactory::getApplication();
$app->enqueueMessage('Your message here !');
?>

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

  • Posts: 139
  • Thank you received: 1
10 years 9 months ago #172168

Thanks for that but just one more question I will obviously have to have an if statement which says

if (product in basket) then do the code which you have give.

How do I test for the desired product it what does the condition part of the if statement look like?

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

  • Posts: 12953
  • Thank you received: 1778
10 years 9 months ago #172227

Hello,
You'll just have use some code like :

if($row->product_id == YOURPRODUCTID){

}
Just after this line :
foreach($this->rows as $i => $row) {

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

  • Posts: 139
  • Thank you received: 1
10 years 9 months ago #172328

On further thought I need it to be for a product in a particular category.

Can I change product_id to category_id? And will it be in the same place

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

  • Posts: 26253
  • Thank you received: 4040
  • MODERATOR
10 years 8 months ago #172340

Hi,

If you want to base you check on the product category, you will have to perform a more complex algorithm.
A product can be in several categories, so we do not load all the categories every time (just when it is really needed).
You can have the category list under "$row->categories" but if not, you have to load them yourself.

It requires some development and PHP skills.

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.

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

Time to create page: 0.084 seconds
Powered by Kunena Forum