special cart setup

  • Posts: 171
  • Thank you received: 4
11 years 10 months ago #84672

hey,

i have two categories with more categories and products in them

if i have added a product from the one category-tree and try to add a product from the other category tree, i wanna do a popup or something that gives an error and don't add it to the cart... is this possible ?

regards
Jesper

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

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

Hi,

Everything can be possible, but in that case it will require some development.
You will have to create a plugin which will be called on product add in the cart, and this plugin have to check the current products in cart and see if all the products are from the same category, if they are not from the same category then display a popup and remove the object containing the product to not add it to the cart.

It require good php knowledge, you can too post a request on the commercial jobs section of this forum.

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

  • Posts: 171
  • Thank you received: 4
11 years 9 months ago #88442

so i got this working with onBeforeCartUpdate and JError::raiseWarning( 100, JText::_('ERROR_MSG10') );

now the client want to have popup and ajax enabled... now it doesn't display the error anymore, but still doesn't add to the cart as it should.
is there any other function i should call to get the error on the popup and not say success ?

right now i just do
$do = false;
JError::raiseWarning( 100, JText::_('ERROR_MSG10') );
if not allowed to add to cart.

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

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

I think that you can add the message in the Joomla warning messages with:

$message = 'YOUR_MESSAGE';
$app = JFactory::getApplication();
$app->enqueueMessage( $message );

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

  • Posts: 171
  • Thank you received: 4
11 years 9 months ago #88612

when i enable ajax, this message is now showed on the popup basket window that hikashop produces

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

Time to create page: 0.064 seconds
Powered by Kunena Forum