View Single Post
  #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