Jump to content

Used custom fields (group customer) to show / hide products in a category


Benach

Recommended Posts

Hello everyone,

I apologize in advance for my English translated by Google translate ...
 

Context : 

Some products in my catalog are only available for professionals or for individuals or for everyone, but this condition must do when displaying products in a category (which can be seen by everyone or not). That is why the solution to hide a category custom group can not work in my case.
In order to implement this solution I created a custom field in the product table "group_customer" and runs it through an override product.php the class and the view in the admin. On this side everything works perfectly, and can handle some necessary conditions produc.tpl.

But not being developer I'm stuck with regard to product display (product-list.tpl) custom group in the desired category. I do not know if I should intervene at the SQL query getProduct or from the controller via parameters in my condition custom group and value in the product.
I would really like to understand how to proceed in order to mount competence in that area.

To sum up :
> custom field "group_customer" in detail product as a possible value: 'all', 'private', 'professional';
> customer group: Visitor (1) - Guest (2) - Private (3) - Business (4);

My conditions when displaying:
$ GroupCustomerLogin == FrontController::getCurrentCustomerGroups();

if ($ groupCustomerLogin == 1,2,3) {
   $ GroupCustomerProduct == 'all', 'private';
} Elseif ($ groupCustomerLogin == 4) {
   $ GroupCustomerProduct == 'all', 'professional'
}

Can pass in the result to see that the products concerned ... your help is welcome :-)


Thank you in advance for your generous support.


Best regards.

Edited by Benach (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...