VM3.0.0 shopper groups do not work

Please post your issues and questions about One Page Checkout for Virtuemart 2 to this forum.

VM3.0.0 shopper groups do not work

Postby admin » Fri Nov 21, 2014 3:49 pm

Hello friends, if you updated to the yesterday official release of new Virtuemart 3.0.0, these are our latest experience on the most common issues that you can come around:

OPC
- OPC is compatible with VM3.0.0 but we suggest to disable "show weight in the basket" feature until we release 267 version.
- support of Zasilkovna on OPC on VM3 will also be available in 267
- all other plugins, opc logic is working properly
- version 267 will also include an enhanced cart reload plugin for VM3

Virtuemart itself
- shoppper groups problem:
-- under some circumstances products assigned ONLY to a specific shopper group will not show for the logged in user with that shopper gropu

How to reproduce:
1. configure the product:
Image
2. configure the shopper:
Image
3. open your:
\purity\administrator\components\com_virtuemart\models\user.php
4. locate the cateogry which shows the product (on default vm3 data it could be: index.php?option=com_virtuemart&view=category&virtuemart_category_id=5)
5. log in as the user above with the proper shopper grop
6.

within the user.php file:
add stop code:
Code: Select all
public function getCurrentUser(){
   $x = debug_backtrace(); foreach ($x as $l) echo $l['file'].' '.$l['line']."<br />\n"; die();


and
Code: Select all
   public function setId($cid){
$x = debug_backtrace(); foreach ($x as $l) echo $l['file'].' '.$l['line']."<br />\n"; die();


another stop code:
Code: Select all
/**
    * Retrieve the detail record for the current $id if the data has not already been loaded.
    * @author Max Milbers
    */
   function getUser(){

      if(!empty($this->_data)) return $this->_data;

      $db = JFactory::getDBO();

      $this->_data = $this->getTable('vmusers');
      $this->_data->load((int)$this->_id);
      $this->_data->JUser = JUser::getInstance($this->_id);

      // Add the virtuemart_shoppergroup_ids
      if(!empty($this->_id)){
         $xrefTable = $this->getTable('vmuser_shoppergroups');
         $this->_data->shopper_groups = $xrefTable->load($this->_id);
      }
      
      var_dump($this->_data->shopper_groups);
      var_dump($this->_id);
      die();


7. now, if you see a stop code which shows list of your files from any plugin or module, disable the plugin OR module within joomla config
8. repeat step 7 unless you get to int(0) as the html output
8.x -> if you see an ID of your user, than your NOT AFFECTED BY THIS ISSUE
9. remove the stop codes (reverse all the changes)
10. you will see that the category list DOES NOT INCLUDE THE PRUDUCT ASSIGNED TO THE SHOPPER GROUP

to fix this problem you can do this:
11:
Code: Select all
  /**
    * Retrieve the detail record for the current $id if the data has not already been loaded.
    * @author Max Milbers
    */
   function getUser(){
       if (empty($this->_id))
      $this->_id = JFactory::getUser()->get('id', 0);
      // if(!empty($this->_data)) return $this->_data;


that reloads the user_id when it's not anonymous user (guest)
i also would suggest to disable the user cache by commenting the //if(!empty($this->_data)) return $this->_data;


MOST COMMON ISSUES WHEN UPDATEING TO VM3 (from VM2.0.26D without updating the theme)
1. the new product details page now does not include the "add to cart" javascript by default. Therefore if you tempalate does not include, it you may need to add:
Code: Select all
vmJsApi::writeJS();

to your:
\templates\{your joomla templaet}\html\com_virtuemart\productdetails\default.php

othersie the add to cart may not work at all

2. We also noticed that links returned VM are not sefed anymore, therefore you may need to search for all occurances of ->product_url within your system and if it says $product->product_url you may need to update it to JRoute::_($product->product_url)

3. the new VM3 comes with a new price display, so if your prices now include "with tax 27%" or similar, you may need to hide this with:

Code: Select all
span.vm-price-desc {
display: none !important;
}


within your joomla's template main or virtuemart CSS file
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Re: VM3.0.0 shopper groups do not work

Postby admin » Fri Nov 21, 2014 6:08 pm

official VM3.0.0 patch for future VM versions will include a modification in:
\administrator\components\com_virtuemart\models\product.php

locate this code:
Code: Select all
      if ($isSite) {
         $usermodel = VmModel::getModel ('user');
         $currentVMuser = $usermodel->getUser ();
         $virtuemart_shoppergroup_ids = (array)$currentVMuser->shopper_groups;



and update to:
Code: Select all
      if ($isSite) {
         $usermodel = VmModel::getModel ('user');
         $currentVMuser = $usermodel->getCurrentUser ();
         $virtuemart_shoppergroup_ids = (array)$currentVMuser->shopper_groups;



best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm


Return to One Page Checkout for Virtuemart 2

cron