- Posts: 23
- Thank you received: 0
Product price editable on checkout
-- Joomla version -- : 3.4.3
-- PHP version -- : 5.4
-- Browser(s) name and version -- : Chrome
I don't know if there is an easy way to do this, but as I wrote on title I need to get editable the product price on checkout page. I checked cart.php but it'ìs a little hard to understand where I need to edit the code.
thanks in advance
Please Log in or Create an account to join the conversation.
Both Joomla and HikaShop are coming with tools to override such text, means for you to change it to whatever you prefer it to be. For the HikaShop tool see the documentation here: hikashop.com/download/languages.html#modify
Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
toninom wrote: ... as I wrote I don't need to edit the language file, but I need to make the price editable ...
Sorry, got that wrong, probably because most of your post referred to and quoted the table header and the text placeholder.
I'm sure the HikaShop guys will be commenting on your "real" question soon.
Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )
Please Log in or Create an account to join the conversation.
I'm sorry but that kind of thing won't be possible without the item custom fields and some custom code.
First, to have an editable price in the product page, you need item custom fields.
See : demo.hikashop.com/index.php/fr/hikashop/...t-page/donation-page
Then, to edit an item custom field directly during the checkout ; it requires a pretty important custom development in order to add the feature allowing the edition of item custom field value directly in the cart, during the checkout.
And that's not something which can be done in a few minutes.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
Thanks again for your time and your support
Please Log in or Create an account to join the conversation.
I can't give you any hint if I don't understand your base structure.
You can't modify any product price anywhere in HikaShop ; except if you're using something like the donation plugin and I already gave you that information.
So without any details about your structure or website ; I am not able to help you or give you other useful details.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
I checked cart.php and listing_price.php (components/com_hikashop/views/checkout/tmpl) but it's a little hard to understand how the code works.
Hoping to have been clearer, thanks again for your help
Please Log in or Create an account to join the conversation.
You can't modify the price of a product in the cart. That's because products in the cart don't have any price. They just use the price of the product entry.
That's why, as Jerome said, you need to create a custom item field to be able to store that price value of the product in the cart.
Then, you need to use the donation plugin so that you can use that price instead of the normal price of the product.
And finally, you need to edit the "cart" of the view "checkout" in order to modify the display of the price in order to use an input field and then you want to create a system plugin implementing the onAfterRoute trigger of Joomla in order to catch the value entered in that field when the cart view is submitted on the checkout and update it in the entry of each product in the cart in the table hikashop_cart_product with a MySQL query.
That method will work and require only PHP and MySQL knowledge and looking at the checkout/cart view and the hikashop_cart_product table of your database. So that should be enough to get started if you're a developer. Otherwise, you can contact our partners for a quote on such custom development.
www.hikashop.com/home/our-partners.html
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Can you give me some help ?
Please Log in or Create an account to join the conversation.
You can load the full order but you shouldn't use it as a parameter for the "save" function.
Using a stdClass like you did is the right solution ; otherwise you can use an object from the "orderClass->get" function.
For your sample code, you didn't modify anything in the order, so there is nothing to do in the database.
If you want to modify something in the "order" table, you can use that "$ordine" object ; but if you want to change products in that order (in fact, "order_product"), it is more complicated than that.
You need to add the "order_product" entry, you need to reprocess the order prices, etc.
You should use a trigger and modify the order content before the order save ; it would be easier than trying to load and modify an order directly from the database.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Please Log in or Create an account to join the conversation.
With use a trigger you mean to write a plugin ? Which triggers should I use ? How can I load the fullorder inside the plugin ? Should I import some specific files ?
Really thanks again
Please Log in or Create an account to join the conversation.
The save function of the class.order has two cases where it can handle products:
- when you create a new order, you can pass all the data of all the products in $order->cart->products
- when you update an existing order, you can pass the products data in $order->product
in both cases, it must be an array and in the second case, you of course need to pass the order_product_id attribute in each product.
Then, you can use the save function on your order object with the data in it.
If you want to modify the order content before the order is created, you can implement the onBeforeOrderCreate trigger in a hikashop plugin. But this supposes that you already have the data on hand at that point. Not knowing the details of what you did, the edition of the end view like you did might be better.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
I tried everything, I'm not able to modify the "order product" through the hikashop framework, how is it possible ?
Should I use the save of class.order_product or class.order? I tried both with no result.
I think I miss something.
Should this work ?
Please help me.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
The recalculateFullPrice function requires that you provide a $order object and it will modify directly that object. If $order is null in there, it means that you give a null $order when calling the function.
You can't give a $product object to the save function of class.order_product, you can only give it an array of $product objects. So for example, like that:
We use both methods throughout the code of HikaShop and it works just fine.
Please Log in or Create an account to join the conversation.