customization of the product view via php code.

  • Posts: 5
  • Thank you received: 0
9 years 5 months ago #234117

-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.5
-- PHP version -- : 5.5.6

Hello

I would like to know how to solve these problems :

1) when i go to my shop, I want to add a message in a popup displaying an information coming from my database (ex : "suscription will start as from week xx", xx is read in my sql table depending on condition).

2) display the button 'add to cart' whatever the view, depending on a control on my database.
For example, in my shop I have some subscriptions to buy. If the user has already one of the subscriptions, i want this product to have a message 'already suscribed' instead of the button 'add to cart'

Thanks a lot for your help and for code example.

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

  • Posts: 84307
  • Thank you received: 13701
  • MODERATOR
9 years 5 months ago #234135

Hi,

1. Well, you can add custom PHP to the view displayed when you arrive in your shop. As we don't know what page you're using for that, we can't tell you where you should add that exactly.

2. If you want to customize the display of the add to cart button, you can edit the file "quantity" of the view "product" via the menu Display>Views.
You should find there several times the line:

echo $this->cart->displayButton(JText::_('ADD_TO_CART'), 'add', $this->params, $url, $this->ajax, '', $max, $min);
which displays the add to cart button. So just add a condition on that based on your subscription.

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

  • Posts: 5
  • Thank you received: 0
9 years 5 months ago #234323

hello

Thanks for the answers

pour le 1 : index.php?option=com_hikashop&view=category&layout=listing
pour le 2 : I'm going to try...no other solution than hacking the code ? Not possible to do it by API ?

Merci

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 5 months ago #234325

Hi,

1. You will see more details in that documentation page :
www.hikashop.com/support/documentation/1...-display.html#layout

2. Using the API you can avoid the addition of the product in the cart ; you can also change dynamically the data in order to change the product quantity (or another element which will make the product not available for sale) and add some data which would be display in the listing/product page.
See " onBeforeProductListingLoad " and " onHikashopBeforeDisplayView "
www.hikashop.com/support/documentation/6...reProductListingLoad

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.060 seconds
Powered by Kunena Forum