close the model window with the add to cart button

  • Posts: 8
  • Thank you received: 0
11 years 7 months ago #142522

-- url of the page with the problem -- : cafetariadeambacht.nl/bestel
-- HikaShop version -- :HikaShop Business: 2.2.3
-- Joomla version -- :2.5.17 Stable
-- PHP version -- :5.4.17
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message

Hi,
I want my product view to show in a pop-up, i have done it like explained here: www.hikashop.com/forum/2-general-talk-about-hikashop/64478-characteristics-options-in-add-to-cart-popup-help.html

And it works fine but now it has to close when i click on the add to cart button. is this possible??


thanks frank

Attachments:

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

  • Posts: 84290
  • Thank you received: 13691
  • MODERATOR
11 years 7 months ago #142579

Hi,

I guess that you'll want to change the line:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min);

of the view file quantity (via Display>Views) to something like that:

echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,'window.top.hikashop.closeBox();'.$this->ajax,'',$max,$min);

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

  • Posts: 8
  • Thank you received: 0
11 years 6 months ago #142599

Hi Nicolas,

Thanks for the help and quick reply.
I changed the line in the quantity file. and now he close with the button :) , but he doesn't do the add to cart function anymore.
do u have any suggestion what could cause that?

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

  • Posts: 2334
  • Thank you received: 403
11 years 6 months ago #142629

Try this instead:

echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax.'window.top.hikashop.closeBox();','',$max,$min); 

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

  • Posts: 8
  • Thank you received: 0
11 years 6 months ago #142672

i tried it, but now the model doesn't close anymore..

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

  • Posts: 2334
  • Thank you received: 403
11 years 6 months ago #142688

Does it add to cart? Do you have a JS message? Maybe this will be enought:

echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax.'; window.top.hikashop.closeBox();','',$max,$min); 

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

  • Posts: 8
  • Thank you received: 0
11 years 6 months ago #142706

Yes it did add to cart and with the last modification it still add to cart. but not closing the model.
What do u mean with JS message?

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

  • Posts: 2334
  • Thank you received: 403
11 years 6 months ago #142725

I just checked, could you put back Nicolas code so I can try again and see what's wrong?

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

  • Posts: 8
  • Thank you received: 0
11 years 6 months ago #142787

oke, Nicolas his code is back now ;)

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

  • Posts: 2334
  • Thank you received: 403
11 years 6 months ago #143478

Really? It does close but doesn't add to the cart, that's not what Nicolas' code should do?
Anyway it's going to be a bit harder than I though. The code that add to the cart end up by reloading the page so you can see you added your product. In this case the code closing the popup can't be executed so it will require mode code at different steps.

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

  • Posts: 8
  • Thank you received: 0
11 years 6 months ago #143994

Yes that was indeed the result of nicolas'code modification.
yes he have to close just before the refresh but that wont be possible?

Maybe it makes a deference if we use dialog instead of mode?
Or on the product_list as accordion?

And thank you very much for the support so far.

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

  • Posts: 2334
  • Thank you received: 403
11 years 6 months ago #144563

You can try this solution but I'm not sure it will work.
The problem is that the code called to add to cart is also called in other places and modifying it may create issues on other aspects.

The function called is hikashopModifyQuantity in the file cart.php (administrator/components/com_hikashop/helpers).
You can try to add the code window.top.hikashop.closeBox(); either à the beginning (after the '(' ) or after these lines:

if(hikaModule) hikaModule.innerHTML = result;
			};

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

  • Posts: 8
  • Thank you received: 0
11 years 5 months ago #147646

Hi,
I've tried putting the code at both places (and some other places i could think of). but it doesn't work.
its either closing or add to cart never both..

May it help to use a dialog instead of model?

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

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

Hi,

Have you tried tu put it after:

if(hikaModule) hikaModule.innerHTML = result;
and before the "};" ?

In this file the function is present twice, have you tried to add the code at the both places ?

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

  • Posts: 8
  • Thank you received: 0
11 years 5 months ago #148594

To make sure i've just tried that again

put the code
window.top.hikashop.closeBox();
after both
if(hikaModule) hikaModule.innerHTML = result;
lines

But it doesn't close the model

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

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

Hi,

So it will require more editions than just add some javascript.
As it's a customization, we can't really help you on the forum.

If you really need this feature, you can potentially post a request in the commercial jobs part of our forum.

Last edit: 11 years 5 months ago by Xavier.

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

Time to create page: 0.118 seconds
Powered by Kunena Forum