Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Add2CartPopoup module help

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 06-25-2015, 01:51 PM
 
Kackavaljer Kackavaljer is offline
 

Newbie
  
Join Date: Apr 2015
Posts: 4
 

Default Add2CartPopoup module help

Hi,

I want to open Add2CartPopoup module directly width out adding the product to the cart (the popup that opens when you click "add to cart" button). So far, i managed to create a button that opens it open it, but it always opens the last product that was added to the cart.
Below is the JS that handles this, and it is in an event listener. I passed productID and that is the id of the product, but I have not succeeded in getting it to open correctly.

Any ideas?

Code:
this.popupResult = !popup.load( URLHandler.buildURL({ target: 'add2_cart_popup', productID: pid }), { dialogClass: 'add2cartpopup', } );
__________________
X-Cart 5
Reply With Quote
  #2  
Old 06-26-2015, 12:04 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Add2CartPopoup module help

Hello @Kackavaljer,

As far as I understand, you want to show Add2Cart popup without product, right? If so, you need to write a new widget, because current implementation of Add2Cart popup assumes a product that will be displayed in top left area.

Please, let me know if it helps.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #3  
Old 06-29-2015, 01:54 AM
 
Kackavaljer Kackavaljer is offline
 

Newbie
  
Join Date: Apr 2015
Posts: 4
 

Default Re: Add2CartPopoup module help

No, I need to open the Add2Cart popup with the product, but width out adding the product to the cart.
__________________
X-Cart 5
Reply With Quote
  #4  
Old 06-29-2015, 06:14 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Add2CartPopoup module help

What product you want to display in this popup?
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #5  
Old 06-29-2015, 07:16 AM
 
Kackavaljer Kackavaljer is offline
 

Newbie
  
Join Date: Apr 2015
Posts: 4
 

Default Re: Add2CartPopoup module help

The one i clicked on.
__________________
X-Cart 5
Reply With Quote
  #6  
Old 06-29-2015, 07:22 AM
 
Kackavaljer Kackavaljer is offline
 

Newbie
  
Join Date: Apr 2015
Posts: 4
 

Default Re: Add2CartPopoup module help

It should display the Add2Cart popup instead of the standard QuickLook popup but not to add the product to the cart. I will add a custom Add to cart button to that new popup.
__________________
X-Cart 5
Reply With Quote
  #7  
Old 07-07-2015, 04:51 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Add2CartPopoup module help

Hello @Kackavaljer,

Here is how you can try to achieve it.

1) You need to decorate JS' ProductsListView.prototype.postprocess method described in the <X-Cart>/skins/default/en/items_list/product/products_list.js file, so it would work with add2_cart_popup target instead of quick_look.

Example of decorating JS scripts is in the <X-Cart>/skins/default/en/modules/XC/ProductComparison/compare/products/script.js file that decorates the same method.

2) Then, we need to apply changes to \XLite\Module\XC\Add2CartPopup\View\Add2Cart widget.

The condition
PHP Code:
if ($this->getParam(static::PARAM_DISPLAY_CACHED)) { 
should be replaced with this one:
PHP Code:
if ($this->getParam(static::PARAM_DISPLAY_CACHED) && !\XLite\Core\Request::getInstance()->product_id) { 

and the getProduct() method should be defined as follows:
PHP Code:
protected function getProduct()
   {
       if (\
XLite\Core\Request::getInstance()->product_id) {
           
$product = \XLite\Core\Database::getRepo('XLite\Model\Product')->find(\XLite\Core\Request::getInstance()->product_id);
       }

       if (!
$product && $this->getItem()) {
           
$product $this->getItem()->getProduct();
       }
       return 
$product;
   } 

Please, let me know if it helps.

Tony
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:30 AM.

   

 
X-Cart forums © 2001-2020