- Posts: 15
- Thank you received: 0
Apply a custom price to an external product
14 years 3 weeks ago - 14 years 3 weeks ago #72331
by Teonnyn
Apply a custom price to an external product was created by Teonnyn
I have an Invoice product I'm trying to import into the user's shopping cart - this product is dynamically created and priced, and it seems as if the Donation plugin would be perfect to get it in the system. However.. how do I use this plugin inside a custom component? What would I use to call it, and where would I put the product price?
Last edit: 14 years 3 weeks ago by Teonnyn.
Please Log in or Create an account to join the conversation.
14 years 3 weeks ago - 14 years 3 weeks ago #72351
by Teonnyn
Replied by Teonnyn on topic Apply a custom price to an external product
Okay.. here's what I'm trying to do - I have an external component and it generates a price. I want to export that price into HikaShop onto the donation item and into their shopping cart. At the moment I have the code for the demo mostly working but it won't affect the product price.
Price: <input id="amount" type="text" value="<? print_r($orders[0][7]); ?>" readonly="readonly" onSubmit="hikashopToggleFields(this.value,'amount','invoice_order',0);" name="data[invoice_order][amount]"/>
Amount: <input id="hikashop_product_quantity_field_1" type="text" value="1" readonly="readonly" />
</td>
<td rowspan="2">
<input type="submit" class="button hikashop_cart_input_button" name="add" value="Add to cart" onclick="var field=document.getElementById('hikashop_product_quantity_field_1');if(hikashopCheckChangeForm('item','hikashop_product_form')){ return hikashopModifyQuantity('359',field,1,'hikashop_product_form','cart'); } else { return false; }">
Price: <input id="amount" type="text" value="<? print_r($orders[0][7]); ?>" readonly="readonly" onSubmit="hikashopToggleFields(this.value,'amount','invoice_order',0);" name="data[invoice_order][amount]"/>
Amount: <input id="hikashop_product_quantity_field_1" type="text" value="1" readonly="readonly" />
</td>
<td rowspan="2">
<input type="submit" class="button hikashop_cart_input_button" name="add" value="Add to cart" onclick="var field=document.getElementById('hikashop_product_quantity_field_1');if(hikashopCheckChangeForm('item','hikashop_product_form')){ return hikashopModifyQuantity('359',field,1,'hikashop_product_form','cart'); } else { return false; }">
Last edit: 14 years 3 weeks ago by Teonnyn.
Please Log in or Create an account to join the conversation.
14 years 3 weeks ago #72583
by nicolas
Replied by nicolas on topic Re: Apply a custom price to an external product
Hi,
The problem comes from the name.
It should not be data[invoice_order][amount] but data[item][amount]
"item" in the data variable is the table of the custom field. So it has to be item and you have to have a custom field of the table "item" with the column name "amount" already created.
You can see any example on our demo website:
demo.hikashop.com/index.php?option=com_h...ct&task=show&cid=214
The problem comes from the name.
It should not be data[invoice_order][amount] but data[item][amount]
"item" in the data variable is the table of the custom field. So it has to be item and you have to have a custom field of the table "item" with the column name "amount" already created.
You can see any example on our demo website:
demo.hikashop.com/index.php?option=com_h...ct&task=show&cid=214
Please Log in or Create an account to join the conversation.
Time to create page: 0.058 seconds