| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Set product quantity by counting characters in a text field. | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Set product quantity by counting characters in a text field.
Hey guys,
I'm trying to change how quantity is calculated on the product page. We sell dimensional letters, which are sold by the letter. For example, if someone orders "Elementary School", that's a quantity of 16 letters. I'd like to calculate the quantity based on the characters that typed into a text field, rather than have the customer select the quantity from a dropdown and risk them mis-counting / mis-selecting the number of letters. I've written the javascript to calculate the number of letters (minus spaces) from a text field, and am trying to get it integrated into x-cart through the "custom javascript" page in the admin area. It works on it's own, but I am not sure of the correct selectors to use to get it to work with x-cart. Here is a link to a JSFiddle with the code I wrote: http://jsfiddle.net/npav42/n7khd6kr/3/ If there is anyone that could help out with this that would be a huge help!
__________________
X Cart 5.3.4.5 mountingstandoffs.com |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Set product quantity by counting characters in a text field.
The "Custom JavaScript" page is definitely not the way to go for such a complex modification.
Instead you should create a custom module that loads your JavaScript file on the product page: http://kb.x-cart.com/display/XDD/Adding+CSS+and+JS+files The tutorial explains how to load a custom JS file on every site page, but in your case you should inject it into one of the widget classes that are displayed on the product page only. Perhaps, the quantity box is the widget that you should extend from your module.
__________________
Alex Solovev, Qualiteam --- User manual Video tutorials X-Cart FAQ You are welcome to press "Thanks" button if you find this post useful Click here to learn how to apply patches X-Cart Extensions |
|||||||||
|
|||
X-Cart forums © 2001-2020
|