Jump to content

New attributes for product in code


Daimos
 Share

Recommended Posts

Hi,

Im trying to put new attributes directly from module (PS 1.6). My objective is new attribute for my guests, that affect price. Its width of element for order. Price calculated based on price for one meter and width.

And now i have few questions.

 

1. Where to put that information (width), after my customer will fill it. It will be better if i put it on new table, or better to modify all tables responsible for order? If new table is better, then when i need to pull this data? I know, that for sure:

- cart (to show user selected width)

- order... invoice

maybe somebody can help with finding methods/places for that? 

 

2. Product::getPriceStatic is the only method i need to modify for calculating price? I think its easiest way to multiply quantity before return the price, correct?

 

3. My other problem is attribute with color. I need to write this attribute in code, because original attributes are bad for me. With two attributes, for example:

- COLOR,

- SURFACE,

if i have 20 surfaces and 100 colors, prestashop create 2000 products, insane! With 5000 products like that i think that i will need few servers with load balancer ;)

So im trying to create simple "color" attribute in code, without influence on price. Again, is best way to keep selected colors in other table? Or modify all tables? If i need to modify original tables, which ones?

* cart_product

* orders

* order_detail too?
 
Thank You for help in advance.
 
Most important. Yes i know, there are plenty of modules with attributes like that, but im learning and i want to make my own.
Edited by Daimos (see edit history)

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More