Error with Super Administrator cannot add product in multivendor

Started by Freddo, October 03, 2016, 12:33:17 PM

Previous topic - Next topic

Freddo

With a super user account, if i go to products and then choose from the dropdown vendor list "please select" then click add new product i get COM_VIRTUEMART_ALERTNOTAUTHOR error...
I tried to alter a bit the code on administrator/components/com_virtuemart/views/product/view.html.php

on line 72 to :
            if ((($superVendor != 1) && ($superVendor != $product->virtuemart_vendor_id)) && !(JFactory::getUser()->get('isRoot'))) {

and it is ok for super admin to add products...
not a fix but i have a multivendor store and i want to add some products with no vendor as i want them to be common in all vendors...

Milbo

You did not write your vm version, ...

Atm we have in the core

$superVendor = vmAccess::getVendorId();
if( $superVendor !=1 and $superVendor!=$product->virtuemart_vendor_id){
   JFactory::getApplication()->redirect(.....);
}


This means, if you are not the Storeowner, or not a Superadmin acting as storeowner, or a user with the right "managevendors", then you cannot edit a product of another vendor.

So, when you set the product to another vendor, you lose the rights to edit it. When you set the product vendor Id to 0, that will make trouble all the time, because there are some fallbacks.
The feature to add products with vendorId=0 is imho not implemented, and your "fix" just changes the possibility to enter it, but I doubt that it will work correctly.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/