Jump to content

Help: Counting Letters In A Texfield And Put Them Into The Shopping Cart


colla

Recommended Posts

Hi all. Meanwhile, congratulations to the PrestaShop software that I find really great and very useful!

 

I have a request to help a bit 'special.

 

I'm building a site, which is still in local, in which sell stickers personalized letters.

 

My problem is: I should find a way to make sure that the amount of letters of a textfield is counted in the amount of the cart automatically.

 

For example if i write MARIO in the textfield the cart has to count qt.y 5

 

The textfield Is created, but unfortunately I have no idea how to count the internal letters.

 

If it would not be easy, or is very complicated to make, I could use a small div next to the textfield showing the exact number of letters-numbers? (obviously not including spaces).

 

Thank you and goodbye.

 

Andrea

Edited by colla (see edit history)
Link to comment
Share on other sites

Hi,

 

You can use a workaround: instead of creating stickers with textfields, create sticker placeholders for sticker types. Then create letter objects, and each of those letters will have a price. Of course, you can use multiple types if needed, maybe with attributes.

 

The other way would imply heavy core modifications with a strlen() on the text field, and some pricing computation I can't think about at the moment. Or you could create a new object type too

 

 

So, If I where in you, I'd go the first way

Link to comment
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
×
×
  • Create New...