Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Add text attribute value entered to base price

Add text attribute value entered to base price

Views: 1,756

Results 1 to 4 of 4
22 Jun 2013, 2:18 PM
#1
danp avatar

danp

New Zenner

Join Date:
Mar 2008
Posts:
32
Plugin Contributions:
0

Add text attribute value entered to base price

Hi, It appears if a product has a text attribute with a product, the value of that entered value can't be added to the price in the cart. Is that right?
I need to be able to add the entered value to the price, this entered value will be one determined by the user.

e.g.
If the base price is say £5 and say 2.5 is entered into the text attribute box, I need the shopping cart to show £7.50 for that product. Or if -1 is entered the price shown will be £4.

I have looked all over and can't find a solution, although there was an old post for an older version of zc that suggested the text attribute value can't be used to do this.

Thanks, Dan

22 Jun 2013, 4:13 PM
#2
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Add text attribute value entered to base price

I'll second that other post. Text in the text attribute box is just text, and can't have a numerical value.

23 Jun 2013, 8:20 AM
#3
danp avatar

danp

New Zenner

Join Date:
Mar 2008
Posts:
32
Plugin Contributions:
0

Re: Add text attribute value entered to base price

Yes, I get that. However, if a bit of text that happens to be a number is entered, I can't see why that text can't used as a number just like any other input box could potentially be used as a number. This could then be used like any other price attribute?

I have seen other older posts where people want to do the same thing, but not a proper solution. e.g. like entering dimensions of a material and this "text value" used to price by attributes.
http://www.zen-cart.com/showthread.php?128393-Adding-Length-Width-Price-Calculations-to-my-cart&highlight=text+value+price+attribute

23 Jun 2013, 11:36 AM
#4
stevesh avatar

stevesh

Black Belt

Join Date:
Feb 2005
Location:
Lansing, Michigan USA
Posts:
19,793
Plugin Contributions:
2

Re: Add text attribute value entered to base price

DanP:

Yes, I get that. However, if a bit of text that happens to be a number is entered, I can't see why that text can't used as a number just like any other input box could potentially be used as a number. This could then be used like any other price attribute?

I would guess it's because that field in the database is of the type 'text', but I'm no SQL expert. I'm sure code could be written that would turn that text to a number and then manipulate it, but it's beyond my skills.

A more complete explanation of exactly what you're trying to do might elict some other ideas.