Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Hide the price on the storefront

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #11  
Old 09-08-2015, 07:28 PM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Hide the price on the storefront

Hello Philippe,

What does "approved as a customer" mean? How do you approve them?

Basically, you should decorate \XLite\Controller\AController class, add your method that does the check and use it instead of isLogged() in your template.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #12  
Old 09-08-2015, 10:47 PM
 
plh plh is offline
 

Senior Member
  
Join Date: May 2004
Posts: 102
 

Default Re: Hide the price on the storefront

Hello Alex,

When products are marked with a specific membership they are not showing.

When products are not marked with a membership class they do show up with prices as soon as someone register, meaning someone entering any kind of information for email and password. The ideal would be for a customer to register and pending admin change of membership prices do not show up.

I failed to find: \XLite\Controller\AController class. Do you mean Classes\XLite\Controller\AController.php? and change:

/**
* Check if current user is logged in
*
* @return boolean
*/
public function isLogged()
{
if (is_null(static::$isLogged)) {
static::$isLogged = \XLite\Core\Auth::getInstance()->isLogged();
}

return static::$isLogged;
}

How do I change it to reflect: Check if Wholesaler is logged in, after admin has changed the user status to "Wholesaler"?

Philippe
Setting up 5.2.6
__________________
X-Cart 4.4.3
- Happily EWD Hosted -
Reply With Quote
  #13  
Old 09-12-2015, 11:07 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Hide the price on the storefront

Okay, Phillipe has engaged me to provide this solution, Thanks.

This is how you can hide prices to anyone that is not a member.

First of all you need to make this modification in your custom module. Here is my tutorial on doing so if you have not done so already: http://kb.x-cart.com/display/XDD/Creating+a+module+for+X-Cart+5%3A+Tutorial+by+Mike+White

The you need to decorate the class Alex referenced above:
classes/XLite/Controller/AController.php
This is demonstrated well here: http://kb.x-cart.com/display/XDD/Step+3+-+applying+logic+changes

Inside your new decorator class place this method:
Code:
/** * Check if current user is a member * * @return boolean */ public function isMember() { $isMember = false; if($this->isLogged()) { $id = \XLite\Core\Auth::getInstance()->getMembershipId(); if ($id > 0) $isMember = true; } return $isMember; }

Now override the templates in your custom skin module. If you need help here is another tutorial on custom skins: http://xcartguru.com/tutorials/x-cart-5-tutorials/building-a-custom-skin-in-x-cart-5/

Override skins/default/en/product/details/parts/common.price.tpl with this:
Code:
{if:isMember()} <widget class="\XLite\View\Price" product="{product}" /> {else:} Must be a member to see prices! {end:}

Override skins/default/en/items_list/product/parts/common.product-price.tpl with this:
Code:
{if:isMember()} <widget class="\XLite\View\Price" product="{product}" displayOnlyPrice="true" /> {else:} Must be a member to see prices! {end:}
Rebuild cache.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
qualiteam (09-14-2015)
  #14  
Old 07-21-2018, 09:55 PM
  designtheweb's Avatar 
designtheweb designtheweb is offline
 

Senior Member
  
Join Date: Mar 2005
Location: Sydney Australia
Posts: 132
 

Default Re: Hide the price on the storefront

hi, is there an update for 5.3? using .twig now.


This link: http://kb.x-cart.com/display/XDD/Creating+a+module+for+X-Cart+5%3A+Tutorial+by+Mike+White no longer exists now.


I cannot see where you can decorate the class.


Any help appreciated.
__________________
"The more you know - the less you pay"

Various websites using

4.66 Pro & 5
Reply With Quote
  #15  
Old 07-22-2018, 12:19 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Hide the price on the storefront

Quote:
Originally Posted by designtheweb
hi, is there an update for 5.3? using .twig now.


This link: http://kb.x-cart.com/display/XDD/Creating+a+module+for+X-Cart+5%3A+Tutorial+by+Mike+White no longer exists now.


I cannot see where you can decorate the class.


Any help appreciated.


Here is the new link.
https://devs.x-cart.com/webinars_and_video_tutorials/creating_a_module_for_x-cart_5_tutorial_by_mike_white.html


It is still referring to X-Cart 5.1 in that tutorial, but we have a huge bunch of new how-to articles on 5.3.x covered in our new developers docs! Check here.
https://devs.x-cart.com/getting_started/
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
designtheweb (07-23-2018)
  #16  
Old 08-11-2018, 10:25 PM
  designtheweb's Avatar 
designtheweb designtheweb is offline
 

Senior Member
  
Join Date: Mar 2005
Location: Sydney Australia
Posts: 132
 

Default Re: Hide the price on the storefront

Thanks but there's no continuity here between the versions so it's impossible to follow. We're now into twigs.
__________________
"The more you know - the less you pay"

Various websites using

4.66 Pro & 5
Reply With Quote
  #17  
Old 08-12-2018, 01:07 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Hide the price on the storefront

Quote:
Originally Posted by designtheweb
Thanks but there's no continuity here between the versions so it's impossible to follow. We're now into twigs.


Almost all articles that are written by X-Cart staff are adapted to 5.3 now.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
  #18  
Old 09-02-2018, 01:24 AM
  designtheweb's Avatar 
designtheweb designtheweb is offline
 

Senior Member
  
Join Date: Mar 2005
Location: Sydney Australia
Posts: 132
 

Default Re: Hide the price on the storefront

Have followed everything but it is hanging when I deploy the store.


Deploying store [step 6 of 13], please wait... Run the "Doctrine_Plugin_ProxyGenerator" plugin...
Run the "Doctrine_Plugin_UpdateModules" plugin... [0.11sec, 1.5MB (601kB)]
__________________
"The more you know - the less you pay"

Various websites using

4.66 Pro & 5
Reply With Quote
  #19  
Old 09-03-2018, 01:22 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Hide the price on the storefront

Quote:
Originally Posted by designtheweb
Have followed everything but it is hanging when I deploy the store.


Deploying store [step 6 of 13], please wait... Run the "Doctrine_Plugin_ProxyGenerator" plugin...
Run the "Doctrine_Plugin_UpdateModules" plugin... [0.11sec, 1.5MB (601kB)]


Is there anything in the error log?
If there is nothing, I would advise to drop X-Cart cache (var/run and var/datacache) and then regenerate the cache manually through PHP-CLI while logged in to the server console over SSH, like this.


Code:
for asdasd in {1..13}; do php admin.php; done;


Most likely it will throw an error you are looking for.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:17 PM.

   

 
X-Cart forums © 2001-2020