| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | Mark Forums Read | User manuals | Login |
Set your own price product | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Set your own price product
Hello,
I am trying to create a product where customers can enter their own price in an input box. I have managed to modify the price of the item in the getClearPrice() method by decorating the XLite\Model\OrderItem.php file through hardcoding of a module. I added the input box by decorating the default\en\product/quantity/body.tpl. I would like to add up the price with the input the client entered in the input box on the product page. Could anyone give me clues for this? Thank you,
__________________
Alex Business 5.3.2.5 Crisp White |
|||||||
#2
|
|||||||
|
|||||||
Re: Set your own price product
No one?
__________________
Alex Business 5.3.2.5 Crisp White |
|||||||
#3
|
|||||||||
|
|||||||||
Re: Set your own price product
I believe you should start looking from the controller class that handles the "add to cart" function (\XLite\Controller\Customer\Cart::doActionAdd()) and go deeper until you find where it creates an OrderItem from the product being added.
Then check if it is your "set own price" price product and override the OrderItem price with the value submitted by the user (don't forget to check against hack attempts).
__________________
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 |
|||||||||
#4
|
|||||||
|
|||||||
Re: Set your own price product
Hello Alex,
thanks for your answer. I'll check out the class you suggested me. But in any case, my biggest problem is to retrieve the submitted value. I've added an input box through the default\en\product/quantity/body.tpl template (I added a second "set your price" box next to the quantity one) and I didn't manage to fetch the value. Perhaps this isn't the best way to do it? Thanks again,
__________________
Alex Business 5.3.2.5 Crisp White |
|||||||
#5
|
|||||||||
|
|||||||||
Re: Set your own price product
You can get a variable from the request with this code:
Code:
__________________
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 |
|||||||||
|
Thread Tools | Search this Thread |
|
|
|
|||
X-Cart forums © 2001-2020
|