| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Membership by "code" and hide non-membership items | ||||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Membership by "code" and hide non-membership items
I have two different things regarding memberships that I'm interested in doing. I wonder if anyone else has done these or knows how to do these.
First, my customer is currently in trial with 5.3.2.3 but will update to the latest in the 5 branch when they go live. They would like us to put a registration code on the register page that allows someone to enter a code. Based on the code the user enters, they would then like the user to be placed into a particular membership immediately/automatically. They have also requested that when a registered member that is part of a membership logs in, they only see products/categories associated with their membership and not the "public"/non-membership items. We discussed the possibility of having all items be part of a membership but that will not work because they still need items that are public for users that are not part of a membership. Any thoughts on this would be very welcomed. Again, this is a V5 customer. Thank you in advance for any ideas on this. Gary.
__________________
Gary |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Membership by "code" and hide non-membership items
> They would like us to put a registration code on the register page that allows someone to enter
> a code. Based on the code the user enters, they would then like the user to be placed into > a particular membership immediately/automatically. Although this is not a complex modification, it requires more changes than can be explained here, in the forums. In a few words you should add a new field widget to the registration form, and then check its value in the controller class that adds the user. > They have also requested that when a registered member that is part of a membership logs in, they > only see products/categories associated with their membership > and not the "public"/non-membership items. The method that filter products depending on the membership condition is this one: \XLite\Model\Repo\Product::addMembershipCondition( ) I think you should look into decorating this method from your custom module and removing the "OR membership.membership_id IS NULL" part of the condition.
__________________
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 |
|||||||||
#3
|
|||||||
|
|||||||
Re: Membership by "code" and hide non-membership items
Thanks Alex - I really need to learn how to extend XC5. I think it's time to spend some time on a test installation to do some learning.
What is the best way to learn this? I'm looking for that "lightbulb moment" - the moment the light bulb turns on in your mind and you say "ah ha". Thanks, Gary.
__________________
Gary |
|||||||
#4
|
|||||||||
|
|||||||||
Re: Membership by "code" and hide non-membership items
Did you check this site?
http://devs.x-cart.com/
__________________
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 |
|||||||||
|
#5
|
|||||||
|
|||||||
Re: Membership by "code" and hide non-membership items
How do I go about requesting a quote again?
__________________
Gary |
|||||||
#6
|
|||||||
|
|||||||
Re: Membership by "code" and hide non-membership items
I created a module - I put in the code to limit the products by membership to only those products associated with the membership.
After doing so, I noticed the products were fine, but not the categories. So, I put similar code in a module which extends the category. However, the problem I am having is that it doesn't work. I'm still getting all the categories. I put logging in so I can see that my code is running, but it's not limiting the categories as I would have expected. It should only be returning categories for which the membership id is 2 in this case, but I am getting them all back. The PHP code is pretty straight forward: Code:
I'm not sure what's causing my problems at this point nor where to go to find more information. I did notice that the Category is using $queryBuilder->leftJoin whereas the Product is using $queryBuilder->linkLeft. I'm not sure if that's part of the problem or not.
__________________
Gary |
|||||||
#7
|
|||||||||
|
|||||||||
Re: Membership by "code" and hide non-membership items
The code looks good except users having no membership will see all categories due to the "if ($membership)" condition.
Is it the problem that you face? Or does it happen to users having a membership? You may use \XLite\Logger::logCustom('debug', [ /* array of your variables there */ ] ); to log parameters to a log file to check what exactly happens inside your method (and whether it is called at all).
__________________
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 |
|||||||||
#8
|
|||||||
|
|||||||
Re: Membership by "code" and hide non-membership items
The problem I am facing is that when a user logs in WITH membership, they are seeing all the categories rather than just the ones assigned to that membership.
Thank you for following up.
__________________
Gary |
|||||||
#9
|
|||||||||
|
|||||||||
Re: Membership by "code" and hide non-membership items
I believe you don't need the ",true" when calling the logCustom() method.
I.e. it should be something like this: PHP Code:
Does it create the "techanalysts.log.*****" file in the var/log/ directory?
__________________
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 Last edited by qualiteam : 05-03-2017 at 10:25 AM. |
|||||||||
#10
|
|||||||
|
|||||||
Re: Membership by "code" and hide non-membership items
Yes, it creates the file - the "true" tells it to log more information according to the docs in devs.x-cart.com.
From this page: http://devs.x-cart.com/en/misc/debugging_x-cart.html Logging If you need to dump some variable during script execution and you cannot call die(), then you can log the variable during execution by using the following method: \XLite\Logger::logCustom($log_name, $string_to_log, $whether_to_add_backtrace); I think we are getting off topic a bit - I'm not having a problem with logging - I'm having a problem with the HOME PAGE still displaying categories that are not assigned to my membership. it is displaying all categories rather than just the ones for my membership. This is NOT a problem on interior pages, only the home page.
__________________
Gary |
|||||||
|
|||
X-Cart forums © 2001-2020
|