News:

Support the VirtueMart project and become a member

Main Menu

Change shopper group after order confirm

Started by disday, September 03, 2020, 19:13:02 PM

Previous topic - Next topic

disday

Joomla! 3.9.4 and VM 3.6.10
Good day! I faced problem during developing plugin. I create plugin that will be append shoppergroup to user right after order confirmed.
My function is called by event 'plgVmConfirmedOrder' firing.
<?php
function plgVmConfirmedOrder($cart$order)
    
//...
    
$user VmModel::getModel('user');
    
$user->setId($data->virtuemart_user_id);
    
$saveData['virtuemart_shoppergroup_id'] = [$groupToBindID];
    
$saveData['virtuemart_shoppergroup_set'] = 1;
    
$user->saveUserData($saveData);
{
?>

I use User model method VirtueMartModelUser::saveUserData(), it works fine and shopper group binds to user properly when I call my plugin
from admin panel, in this time logged in user has manager access level. But when it is being called on event firing when order confirmed as
default user, in this case method saveUserData() doesn't save shopper group. It happens beacause section that saves shopper group
is under condition checking access level
<?php
if (vmAccess::manager('user.edit') and !empty($data['virtuemart_shoppergroup_set'])) {
?>

Is there in VM special method to change user to manager temporarly for calling this method and save data? Or maybe another trick to save
shopper group data without logging in as manager.
I saw VM has features like FE manager and background manger, maybe them are what i need for my solve my problem. But can not get more info
about them.

Thank you for response!

pinochico

I think for this option  - the plugin is exist a lot of year.
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

disday

Quote from: pinochico on September 03, 2020, 23:32:15 PM
I think for this option - the plugin is exist a lot of year.
This is just one of feature of plugin. Main functionality is interaction with affiliate system and generation of conversions and discounts for shoppers.

pinochico

#3
QuoteThis is just one of feature of plugin. Main functionality is interaction with affiliate system and generation of conversions and discounts for shoppers.

This app exist a long time too - VMA Affiliate, we use it on a many eshops :)

https://www.cannadorra.com/en/affiliate-program
rudolf / rudolf

You can try it :)

Or you can use connection with CJ Affiliate by the plugin Google Tag Manager for Virtuemart.

Existing solutions are many...
www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products

jenkinhill

VM3.6.10 is nearly a year old. There has been a lot of fixes & updates since then. Current release version is 3.8.4.10335
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum