Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

How To Add Dynamic Product Option Rate Topic   - - - - -

 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 20 July 2015 - 05:04 AM #1

Hello

How can I add dynamic option for a product.
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.

Waiting for your replies

 

Posted 20 July 2015 - 04:51 PM #2

hi Elsherif,

not clear why you need it, but cs-cart allows to create global options (menu Products -> Options).
such options can be added to product in 2 ways: linked or unlinked. The linked way means that if you update global option (e.g. change any variant), it will be updated for all products to which the options is linked.

best regards,
WSA team

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11392 posts

Posted 20 July 2015 - 08:42 PM #3

Why can't you just assign your dynamic option to the '$options' from the get_product_options_post hook?

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 21 July 2015 - 05:31 AM #4

hi Elsherif,

not clear why you need it, but cs-cart allows to create global options (menu Products -> Options).
such options can be added to product in 2 ways: linked or unlinked. The linked way means that if you update global option (e.g. change any variant), it will be updated for all products to which the options is linked.

best regards,
WSA team

I can't use this because I want to add the option only in the one case I described (depending on a DB field value that can be changed by my addon) so if the admin changes this field and I'm using your solution the option won't be dynamically deleted.
I hope it is clear to you and thanks for your reply :-)

 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 21 July 2015 - 05:32 AM #5

Why can't you just assign your dynamic option to the '$options' from the get_product_options_post hook?

That will be my last solution ... but as I said the option will have a price modifier so I want to benefit from the automatic price update function when option is checked and that one depends on the option id to work.

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11392 posts

Posted 21 July 2015 - 09:27 PM #6

That would be my first choice and adding it there will be done before any of the cart calculation occurs so any price modifier will be included.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Elsherif
  • Member
  • Trial users
  • Join Date: 10-Jul 15
  • 36 posts

Posted 22 July 2015 - 05:37 AM #7

That would be my first choice and adding it there will be done before any of the cart calculation occurs so any price modifier will be included.

You are right ... but my option will not be stored in the DB and so it doesn't have an ID and the automatic update function depends on option ID to apply the modifier.
Anyway I'm trying this now I hope it goes well ;-)

 
  • abica
  • Member
  • Trial users
  • Join Date: 17-Mar 15
  • 26 posts

Posted 31 October 2015 - 07:35 PM #8

I have products to which can be added other products at their respective prices. For example, I offer gift baskets to which when you choose a design you are given the option to add flowers at $20.00, balloons at $7.00 and a plush toy (teddy bear, etc) at $10.00. These options apply to all of the gift basket designs. My problem isthat I want to change the price of each but don't know how to so that it makes the change for all at one time rather than my having to do it individually for each. Your help will be appreciated.



 
  • abica
  • Member
  • Trial users
  • Join Date: 17-Mar 15
  • 26 posts

Posted 31 October 2015 - 10:09 PM #9

"hi Elsherif,

not clear why you need it, but cs-cart allows to create global options (menu Products -> Options).
such options can be added to product in 2 ways: linked or unlinked. The linked way means that if you update global option (e.g. change any variant), it will be updated for all products to which the options is linked"

 

I can't find any linking option in the global options selection for add new products or for linking exisitng products either?