Welcome Guest, Not a member yet? Register   Sign In
flexi cart - A comprehensive shopping cart library for CodeIgniter
#70

[eluser]haseydesign[/eluser]
Welcome back koichirose,

There is no specifically defined discount column to handle a user group id.
Instead, there are 3 custom status columns that you can define whatever data you want into them - e.g. A user group id.

Within the database discount table, you could for example define the 'custom_status_X' as '3' (User group id = 3).
This would mean that the discount could only be applied to users that are in a user group with the id of 3.

- But how do you set the user group id within your php?
You can use the set_custom_status_X() function to define the user group id to the library session. It will then allow discounts with a 'custom_status_1' column value of '3'.

If you need to get the current custom status defined within the library session, you can use the [email=http://haseydesign.com/flexi-cart/user_guide/cart_config_session_data#custom_status_1]custom_status_X()[/email] function.

There are upto 3 custom statuses that you can define per discount.

----------------------------------------------------------------------------------

Regarding limiting discounts to 1 per user, I seem to remember that I pondered on adding this as a feature, but never implemented it as it is too easy for a user to circumvent.
Basically the library would check whether the users id had ever completed an order with the discount active, if so it would invalidate the discount.

All you would need to do to get around this is create another account to get another user id.

If you wanted to add this yourself, you would need a little custom code.
Save the discount id within the order details table, when a user adds a discount, check whether the specific discount id and user id exist within the table - if so, deactivate the discount.

HTH


Messages In This Thread
flexi cart - A comprehensive shopping cart library for CodeIgniter - by El Forum - 11-12-2012, 04:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB