- Posts: 26
- Thank you received: 0
Adding clear cart button to the showcart view
- issa.mouawad
-
Topic Author
- Offline
Less
More
10 years 4 months ago #240701
by issa.mouawad
Adding clear cart button to the showcart view was created by issa.mouawad
-- HikaShop version -- : 2.6.4
Hi ,
I am using showcart view in a pop up window.
I want to add a button (same as proceed to checkout) that clears the cart contents, I tried to add it like the (proceed to checkout) button ,although it's indeed clearing the cart but it is changing the contents of the pop up window, I want it to close the window(just like the proceed to checkout button does) and redirects the main browser page to the listing page
here's the code I am using
Hi ,
I am using showcart view in a pop up window.
I want to add a button (same as proceed to checkout) that clears the cart contents, I tried to add it like the (proceed to checkout) button ,although it's indeed clearing the cart but it is changing the contents of the pop up window, I want it to close the window(just like the proceed to checkout button does) and redirects the main browser page to the listing page
here's the code I am using
Code:
$clear_url=hikashop::completeLink('product&task=cleancart',false,true);
echo $this->cart->displayButton('Clear Cart','clearcart',$this->params, $clear_url,'window.location=\''.$clear_url.'\'; return false;');
Please Log in or Create an account to join the conversation.
10 years 4 months ago #240755
by nicolas
Replied by nicolas on topic Adding clear cart button to the showcart view
Hi,
Then, instead of:
you want to do:
Then, instead of:
Code:
$clear_url=hikashop::completeLink('product&task=cleancart',false,true);
echo $this->cart->displayButton('Clear Cart','clearcart',$this->params, $clear_url,'window.location=\''.$clear_url.'\'; return false;');
Code:
$clear_url=hikashop::completeLink('product&task=cleancart',false,true);
echo $this->cart->displayButton('Clear Cart','clearcart',$this->params, $clear_url,'window.parent.location=\''.$clear_url.'\'; return false;');
The following user(s) said Thank You: issa.mouawad
Please Log in or Create an account to join the conversation.
- issa.mouawad
-
Topic Author
- Offline
Less
More
- Posts: 26
- Thank you received: 0
10 years 4 months ago #240767
by issa.mouawad
Replied by issa.mouawad on topic Adding clear cart button to the showcart view
I must say, the integration with iframe pop up of joomla is seamless and handy ,
I have worked out the "choose options" to work inside a pop up too , but faced couple issues,
1- I figured out how to create a hyper link that shows the choose options view in a popup , but I would like to use the same standard button (via displayButton helper method) to create the same behavior , so how to pass the needed parameters to the displayButton? (like class = modal and the other parameters)
following is the code I used to display it in hyperlink
2- within the popup when the user clicks "add to cart" , a popup is displayed within the choose options pop up (with two buttons procceed to checkout or contiune shopping) it's very confusing, I want a more logical flow , like for example closing the popup and displaying the "ask_user" popup in the parent, or just closing the popup and refreshing the page, anything logical more than nested popup can work for me
I have worked out the "choose options" to work inside a pop up too , but faced couple issues,
1- I figured out how to create a hyper link that shows the choose options view in a popup , but I would like to use the same standard button (via displayButton helper method) to create the same behavior , so how to pass the needed parameters to the displayButton? (like class = modal and the other parameters)
following is the code I used to display it in hyperlink
Code:
<a class="modal" rel="{handler: 'iframe', size: {x: 760, y: 480}}" href="<?php echo hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row ,true);?>" > Choose Options</a>
Please Log in or Create an account to join the conversation.
10 years 4 months ago #240768
by nicolas
Replied by nicolas on topic Adding clear cart button to the showcart view
Hi,
1. A button uses the input HTML tag. The modal system of Joomla only supports links.
So I don't recommend to use the displayButton function. Instead, just add CSS code so that your a tag looks like a button.
Normally, if you add the button and/or the hikashop_cart_button classes to the a tag it should display like a button:
2. Mmm, I guess that you'll have to edit the file "quantity" and add custom javascript to the displayButton call displaying the add to cart button so that you can close the popup after the add to cart or something like that.
You can use such js to close a popup:
window.top.hikashop.closeBox();
or:
window.parent.hikashop.closeBox();
or:
window.hikashop.closeBox();
based on which popup you want to close where.
1. A button uses the input HTML tag. The modal system of Joomla only supports links.
So I don't recommend to use the displayButton function. Instead, just add CSS code so that your a tag looks like a button.
Normally, if you add the button and/or the hikashop_cart_button classes to the a tag it should display like a button:
Code:
<a class="modal hikashop_cart_button button" rel="{handler: 'iframe', size: {x: 760, y: 480}}" href="<?php echo hikashop_completeLink('product&task=show&product_id='.$this->row->product_id.'&name='.$this->row->alias.$url_itemid.$this->category_pathway,$this->row ,true);?>" > Choose Options</a>
2. Mmm, I guess that you'll have to edit the file "quantity" and add custom javascript to the displayButton call displaying the add to cart button so that you can close the popup after the add to cart or something like that.
You can use such js to close a popup:
window.top.hikashop.closeBox();
or:
window.parent.hikashop.closeBox();
or:
window.hikashop.closeBox();
based on which popup you want to close where.
Please Log in or Create an account to join the conversation.
- issa.mouawad
-
Topic Author
- Offline
Less
More
- Posts: 26
- Thank you received: 0
10 years 4 months ago #240804
by issa.mouawad
Replied by issa.mouawad on topic Adding clear cart button to the showcart view
Hi
thanks it works fine now,
for the display of the link , I actually need to put the link in an article too, but it's not opening the popup , instead it's is opening a new page,
how to solve this issue in joomla ? I checked with firebug, I am getting exactly the same html of the link, but it works in product listing and doesn't work in article
I searched a little, I found solutions to enable iframes in articles, but couldn't find these options in my back end, beside I think they are talking about embedding iframe inside joomla article not with a hyperlink.
I know it's not really related to hikashop , but I appreciate if you can give me a hit on that
thanks it works fine now,
for the display of the link , I actually need to put the link in an article too, but it's not opening the popup , instead it's is opening a new page,
how to solve this issue in joomla ? I checked with firebug, I am getting exactly the same html of the link, but it works in product listing and doesn't work in article
I searched a little, I found solutions to enable iframes in articles, but couldn't find these options in my back end, beside I think they are talking about embedding iframe inside joomla article not with a hyperlink.
I know it's not really related to hikashop , but I appreciate if you can give me a hit on that
Please Log in or Create an account to join the conversation.
10 years 4 months ago #240807
by nicolas
Replied by nicolas on topic Adding clear cart button to the showcart view
Hi,
You need to run that PHP code to load the mootools modal system on these pages:
JHTML::_(‘behavior.modal’);
So you can for example add that at the beginning of the index.php of your template.
You need to run that PHP code to load the mootools modal system on these pages:
JHTML::_(‘behavior.modal’);
So you can for example add that at the beginning of the index.php of your template.
Please Log in or Create an account to join the conversation.
Time to create page: 0.186 seconds