简体   繁体   中英

CS-Cart dynamic option

How can I add dynamic option for a product in CS-Cart? I mean I want to add an extra option to the product in the product page based on a DB field value.

That is my plan for doing this: 1- Add a new hook 'get_product_options_post'. 2- In the function of this hook I will check the DB for some values. 3- Depending on the previous check I will show that extra option or not.

So, as you can see steps 1 and 2 are clear to me I'm just asking about step 3. How can I do this? And take into account that this extra option will also have a price modifier and its value is different depending on that DB check.

Idea

I had another idea for doing this which is adding a new product option at addon installation and then apply that option to the products. But to do that I need to apply the option to a whole category rather than individual products.

This means all current products at the specified category should automatically have the specified option as will as all new products which will be added in the future.

Any suggestion for doing that will also be good.

We can offer you to extend product option statuses and add the Hidden status to two existent ones - Active and Disabled. The hidden options will not be displayed to the customers by default. Then in your hook you will check necessary fields in the database and enable hidden options if necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM