Author Topic: Related products in addtocard pop up window  (Read 866 times)

roman5527

  • Jr. Member
  • **
  • Posts: 100
Related products in addtocard pop up window
« on: August 23, 2018, 12:39:20 pm »
Hi. I want edit related products in addtocard pop up windows.

I want show always only products from one categorie. How i can edit code ?

Thanks

roman5527

  • Jr. Member
  • **
  • Posts: 100
Re: Related products in addtocard pop up window
« Reply #1 on: August 23, 2018, 13:25:46 pm »
Or how i can load module in this pp up window ?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3334
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Related products in addtocard pop up window
« Reply #2 on: August 24, 2018, 01:04:39 am »
File is here : JOOMLA_FOLDER/components/com_virtuemart/views/cart/tmpl/padded.php
Of course, it's better to do an override in your template

roman5527

  • Jr. Member
  • **
  • Posts: 100
Re: Related products in addtocard pop up window
« Reply #3 on: August 24, 2018, 12:22:53 pm »
Thanks i know .

But any idea how i load module here ? Or products from one categories ?

thanks

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3334
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3.0.x.y
Re: Related products in addtocard pop up window
« Reply #4 on: August 24, 2018, 13:08:26 pm »
Code: [Select]
<?php $module JModuleHelper::getModule('mod_NAME''Module title'); 
echo 
JModuleHelper::renderModule($module); ?>
Where mod_NAME is the  folder name(or joomla name) of the module eg. mod_virtuemart_product and 'Module title' the title you have set in the back-end.

roman5527

  • Jr. Member
  • **
  • Posts: 100
Re: Related products in addtocard pop up window
« Reply #5 on: August 25, 2018, 20:57:30 pm »
Thanks . But i paste this code  i have this error in console : http://prntscr.com/kmts41

and pop up dont work , i dont see pop up windows.

can you help me fix it ?


thanks.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3334
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Related products in addtocard pop up window
« Reply #6 on: August 26, 2018, 12:41:46 pm »
If you have already inside <?php ?> you dont need to add it and of course you have to respect the HTML DOM, and module need to be exist and set in Joomla modules list.

roman5527

  • Jr. Member
  • **
  • Posts: 100
Re: Related products in addtocard pop up window
« Reply #7 on: August 27, 2018, 21:05:40 pm »
Hi, my padded.php file is here :

Code: [Select]
<?php
/**
*
* Layout for the add to cart popup
*
* @package VirtueMart
* @subpackage Cart
* @author Max Milbers
*
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2013 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: cart.php 2551 2010-09-30 18:52:40Z milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
echo 
'<div class="left">';
if(
$this->products){
$productModel VmModel::getModel('Product');
    
$product_images $productModel->getProduct($product->virtuemart_product_idtruefalse,true,$product->quantity);
    
$productModel->addImages($product_images,1);
foreach($this->products as $product){
if($product->quantity>0){
echo '<img class="image-pop" src="'.JURI::base(true).'/'.$product_images->images[0]->getFileUrlThumb().'" />';
echo '<h4>'.vmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED',$product->product_name,$product->quantity).'</h4>';
} else {
if(!empty($product->errorMsg)){
echo '<h4>'.$product->errorMsg.'</h4>';
//echo '<h4>'.vmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED',$product->product_name).'</h4><div>'.$product->errorMsg.'</div>';
}
}

}
}
echo 
'</div>';

echo 
'<a class="continue reset button" href="#" >' JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
echo 
'<a class="showcart floatright button" href="'  .JRoute::_("index.php?option=com_virtuemart&view=cart").'">' JText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';

/*   Calling Joomla Module in Virtuemart product page */
 /*  $modules =&  JModuleHelper::getModules('vm-addtocart-position');
   foreach ($modules as $module)
   {
  echo JModuleHelper::renderModule($module);
   }*/
   
$module JModuleHelper::getModule('mod_vm2_products''Skuska'); 
echo 
JModuleHelper::renderModule($module);

?>


and module is enable and assigned to all pages.

But it is JS error.

Any idea ?

Thanks

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3334
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Related products in addtocard pop up window
« Reply #8 on: August 27, 2018, 21:27:56 pm »
Problem is not getFileUrlThumb ? i was thinking it was removed in Virtuemart 3.2 ? But not sure

Try this code
Code: [Select]
<?php
/**
*
* Layout for the add to cart popup
*
* @package VirtueMart
* @subpackage Cart
* @author Max Milbers
*
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2013 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: cart.php 2551 2010-09-30 18:52:40Z milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access'); ?>

<div class="left">
<?php if($this->products){
$productModel VmModel::getModel('Product');
    
$product_images $productModel->getProduct($product->virtuemart_product_idtruefalse,true,$product->quantity);
    
$productModel->addImages($product_images,1);
foreach($this->products as $product){
if($product->quantity>0){ ?>

<img class="image-pop" src="<?php echo JURI::root().$product_images->images[0]->getFileUrlThumb() ?>" />
<h4><?php echo JvmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED',$product->product_name,$product->quantity?></h4>
<?php } else {
if(!empty($product->errorMsg)){  ?>

<h4><?php echo $product->errorMsg ?></h4>
<?php //echo '<h4>'.vmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED',$product->product_name).'</h4><div>'.$product->errorMsg.'</div>';
}
}

}
?>

</div>
<a class="continue reset button" href="#" ><?php echo JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING'?></a>
<a class="showcart floatright button" href="<?php echo JRoute::_("index.php?option=com_virtuemart&view=cart"?>"><?php echo JText::_('COM_VIRTUEMART_CART_SHOW'?></a>
<?php 
// load modules/mod_vm2_products with title  Skuska    
$module JModuleHelper::getModule('mod_vm2_products''Skuska'); 
echo 
JModuleHelper::renderModule($module);

?>


roman5527

  • Jr. Member
  • **
  • Posts: 100
Re: Related products in addtocard pop up window
« Reply #9 on: August 30, 2018, 07:53:17 am »
Thank you very mutch .

But problem is not solved.

i try your code and i see this error : http://prntscr.com/koifag

thanks

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3334
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Related products in addtocard pop up window
« Reply #10 on: August 30, 2018, 13:41:39 pm »
You dont have a javscript error, it's only that jquery try to load the page and you have error 500(PHP error)
You should check the error displayed in your browser console>network but this is a typical syntax error.
Try to comment this lines and see if it work
//$module = JModuleHelper::getModule('mod_vm2_products', 'Skuska');
//echo JModuleHelper::renderModule($module);
But if you  do it yourself, you should learn some PHP tutorial for beginner and how to debug PHP/Joomla

roman5527

  • Jr. Member
  • **
  • Posts: 100
Re: Related products in addtocard pop up window
« Reply #11 on: August 30, 2018, 23:21:35 pm »
Hi. Thanks

But i add your code i dont see pop-up window and product dont add to cart.

When i comment this rows All is ok

Please where is problem?

Thanks

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3334
  • Joomla & Virtuemart addon developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 &amp; 3.0.x.y
Re: Related products in addtocard pop up window
« Reply #12 on: August 30, 2018, 23:31:22 pm »
Activate PHP debug and check the response in your browser console.

roman5527

  • Jr. Member
  • **
  • Posts: 100
Re: Related products in addtocard pop up window
« Reply #13 on: August 31, 2018, 15:08:33 pm »
Hi, i enable show error in joomla configuration to "develop" and i see this in browser console : http://prntscr.com/kp31py

thannks


Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 1667
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Related products in addtocard pop up window
« Reply #14 on: August 31, 2018, 15:37:59 pm »
The errors are quite Self explanatory. Take away your facebook plugin and check server log file for 500 error.

Regards
Jörgen @ Kreativ Fotografi
Joomla 3.8.3
Virtuemart 3.2.12
Olympiantheme Hera (customized)