News:

Support the VirtueMart project and become a member

Main Menu

Not using correct template in Cart view

Started by gofer123, January 18, 2016, 03:23:29 AM

Previous topic - Next topic

gofer123

Hi all,
Have a problem in that I'm using a different template for the e-commerce section of the site, all works well until you hit the "Show cart" option, it displays in the template I used for the non-e-commerce part of the site. I've changed the template settings in VM and the menu item that points to the e-shop to use the e-commerce template (Beez3) but still have this problem.
Any ideas?
Cheers

VirtueMart 3.0.12
PHP 5.5.12
Joomla! 3.4.8 Stable

Studio 42

Hi,
The team decided to remove the  SEF link to the cart vm in 3.0.12, maybe the problem is there?
Some in the forum, have revert the code manually to have the standard Joomla link or perhaps you need to add a Joomla menu link to the cart.

gofer123


gofer123

Sorry to bang on about this but I've tried to alter the code in the mini.cart.php file but can't get it to work, is this the correct file?
Thanks
Cheers

GJC Web Design

there's no such file in VM3 .. 

there is mini_cart.php but think it is only for backward compatibility

if u mean for the popup of the add to cart function it is
components\com_virtuemart\views\cart\tmpl\padded.php
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

gofer123

Thanks for the reply, sorry, I did mean mini_cart.php
I'll experiment with components\com_virtuemart\views\cart\tmpl\padded.php
Cheers

gofer123

Hi,
Not having much luck here, I've included an image to show things a bit clearer.
If I click on the "show cart" in the LHS module. the correct template (Beez3) displays.
If I click on "show cart" pop-up, it displays the site default template which I don't want.
Strangely, if I delete this line:  echo '<a class="showcart floatright" href="' . $this->cart_link . '">' . vmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';
in the padded.php file, it doesn't make any difference.
Any tips.
Cheers

GJC Web Design

padded is definitely the popup

I just fixed a module display prob in the cart page by adding  $this->cart_link . '&Itemid=xxx'
but on the left that is the module

the link comes from  $data = $cart->prepareAjaxData(); in modules\mod_virtuemart_cart\mod_virtuemart_cart.php

prepareAjaxData() is in the FE vm helpers/cart.php
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

Quote from: gofer123 on January 19, 2016, 03:47:13 AM
Hi,
Not having much luck here, I've included an image to show things a bit clearer.
If I click on the "show cart" in the LHS module. the correct template (Beez3) displays.
If I click on "show cart" pop-up, it displays the site default template which I don't want.
Strangely, if I delete this line:  echo '<a class="showcart floatright" href="' . $this->cart_link . '">' . vmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';
in the padded.php file, it doesn't make any difference.
Any tips.
Cheers

A solution is to exchange $this->cart_link with the real llink
jRoute::_('index.php?option=com_virtuemart&view=cart')
This should give you the right link, if the Joomla menu have an associate menu item to this link.
Else you can force the menu item as explained by GJC Web Design

gofer123

Thanks for the replies folks,
I'm not sure how I should insert this link, this the original code from padding.php file, I would be grateful if you could show me what I should be inserting & where please.
Thanks in advance


<?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 '<a class="continue_link" href="' . $this->continue_link . '" >' . vmText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';

echo '<a class="showcart floatright" href="' . $this->cart_link . '">' . vmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';

if($this->products){
   foreach($this->products as $product){
      if($product->quantity>0){
         echo '<h4>'.vmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED',$product->product_name,$product->quantity).'</h4>';
      } else {
         if(!empty($product->errorMsg)){
            echo '<div>'.$product->errorMsg.'</div>';
         }
      }

   }
}


if(VmConfig::get('popup_rel',1)){
   //VmConfig::$echoDebug=true;
   if ($this->products and is_array($this->products) and count($this->products)>0 ) {

      $product = reset($this->products);

      $customFieldsModel = VmModel::getModel('customfields');
      $product->customfields = $customFieldsModel->getCustomEmbeddedProductCustomFields($product->allIds,'R');

      $customFieldsModel->displayProductCustomfieldFE($product,$product->customfields);
      if(!empty($product->customfields)){
         ?>
         <div class="product-related-products">
         <h4><?php echo vmText::_('COM_VIRTUEMART_RELATED_PRODUCTS'); ?></h4>
         <?php
      }
      foreach($product->customfields as $rFields){

            if(!empty($rFields->display)){
            ?><div class="product-field product-field-type-<?php echo $rFields->field_type ?>">
            <div class="product-field-display"><?php echo $rFields->display ?></div>
            </div>
         <?php }
      } ?>
      </div>
   <?php
   }
}

?><br style="clear:both">

GJC Web Design

$newlink = JRoute::_('index.php?option=com_virtuemart&view=cart');

echo '<a class="showcart floatright" href="' . $newlink . '">' . vmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

gofer123

Hi folks,

Played around with those suggestions but can't get it to work, I must be doing something wrong.
To make it easier for all I have uploaded to my server, please have a look here:  http://www.codefarrier.nz/
Please click on the "e-shop" menu tab, I've setup a temp demo shop. If you view the cart by clicking on the "VM - Shopping cart" show cart, everything looks correct but click on the show cart that is within the pop-up and it loads the wrong template. Templates has been set in VM config to Beez3.
Your words of wisdom please.
Cheers

Studio 42

have you set some menu to Virtuemart cart with right template? because this link need it.
Note; you don't need to assign any modules to this menu

gofer123

Thanks but it still doesn't work. I tried unpublished the e-shop menu tab in the main menu, created a new menu with A VM Front Page link and that doesn't work either.
I can't understand why the "show cart" works in the LHS module but not in the popup box?
I don't know too much about PHP but isn't it just the wrong code in this line from the padding.php file?
echo '<a class="showcart floatright" href="' . $this->cart_link . '">' . vmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';

Cheers

GJC Web Design

of course not wrong..  it is a link formed in the cart helper ...

have u done this?

$newlink = JRoute::_('index.php?option=com_virtuemart&view=cart');

echo '<a class="showcart floatright" href="' . $newlink . '">' . vmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';

or this with the menu id you made?


$this->cart_link . '&Itemid=xxx'
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation