News:

Support the VirtueMart project and become a member

Main Menu

Different Shopping Group - Different Label

Started by Bill, May 20, 2016, 18:39:27 PM

Previous topic - Next topic

Bill

Joomla: 3.5.1
VM: 3.0.16
PHP: 5.5.33

Hello,

I can see how to add different shopper groups to a product to have different prices for the same item, but I can't figure out how to assign price labels for those groups on the product page front end.

What I would like is one price for a guest shopper and another price for logged in shoppers. As an example, I would like the price label for the guest shopper to say: List Price and the price for the logged in shopper to say Your Price.

It would be nice to have a field for the label in the Shopper Group or on the Product Page (Product Information tab) where you assign different shopper group prices. Am I missing something? If so, how do I do it?

Thank you,

Bill



Studio 42

You can use the shopper Group ID and change the name depending shoppergroup.
Of course this is not in the core, because i think it's very specific.
YOu can get first user shopper group with :
$userModel = VmModel::getModel('user');
$user = $userModel->getCurrentUser();
$groupId = $user->shopper_groups[0];

After you can use this to set Jtext in \components\com_virtuemart\sublayouts\prices.php

$label = 'COM_VIRTUEMART_PRODUCT_BASEPRICE'.$groupId ;
If (jText::_($label) === $label ) $label = jText::_( 'COM_VIRTUEMART_PRODUCT_BASEPRICE');
and in Joomla language overides ini file add a language key for each group needing another name
COM_VIRTUEMART_PRODUCT_BASEPRICE1="price for shopper group 1"
COM_VIRTUEMART_PRODUCT_BASEPRICE4="price for shopper group 4"

Bill

Thank you, S42. Now, all I have to do is figure out what you told me. Just out of curiosity, do you know if there are any ad-ons that would make this easier?

Thanks again,

Bill

GJC Web Design

highly unlikely there is a plugin for such a specific thing

all S42 is saying is his code snippet adds the SG id to the end of the lang constant

SG id = 1?  the constant = COM_VIRTUEMART_PRODUCT_BASEPRICE1
SG id = 4?  the constant = COM_VIRTUEMART_PRODUCT_BASEPRICE4

add your  COM_VIRTUEMART_PRODUCT_BASEPRICE4 etc as new lang over rides in the normal way
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

Bill

Thanks, GJC,

What you and S42 are saying doesn't sound too difficult, but as I said in my original post, it would be nice to have a field for the label in the Shopper Group or on the Product Page (Product Information tab) where you assign different shopper group prices. Maybe some future release will have that ability? In the meantime, I can get by with the way it is. VM 3 is a good product and I'm very happy with it. Kudos to you and everyone else who has worked on it to keep improving it.

Thanks again,

Bill


Studio 42

Hi Bill,
I don't think, that this a feature needed for general shops, some other then want this for product description, category display ...
I can give 100 example of core changes for my needs. But i never have requested it, because my request is specific and can be implemented without core hacks, simply using template overrides.
If you cannot do it, you have some developer in forum that can implement the code explained in some hours .

Regards

Bill

Thanks again, S42,

I'm good.  I appreciate the information and I appreciate your time.

Bill