News:

Support the VirtueMart project and become a member

Main Menu

Dynamic prices for photos

Started by johaswe, December 01, 2017, 12:54:12 PM

Previous topic - Next topic

johaswe

Hi all!

I have a delicate issue - I have spent days reading and learning here and on the web in general but still no one can answer this question.
- I use VirtueMart 3.2.6 on php 7.0.26 
- I have VMuikit 4.6.0
To set custom prices i have done a custom text input and changed the textinput file to override the price.
When a user selects the product type and size it assigns a value to a j! variable and i fetch that in textinput to change the $modificatorSum.
Now that works awsome! However one thing is strange (AND for this we even bought the  iStraxx customsize to see how it was made and learn.) But it still changes the price for all products in the cart not the one i add to the cart.

Any ideas anyone? I am going crazy about this..

All products is single products with no parents. (ie root products) the products have textinput assigned.
I use this to add to cart : (i fetch casid and customfield id before)

            html.= '<input type="hidden" class="vmcustom-textinput" value="'.$this->selectinfo.'" name="customProductData['.$product->virtuemart_product_id.']['.$cusid.']['.$cfid.'][comment]">';
         $html.= '<input type="hidden" class="pname" value="'.$product->product_name.'"/>';
         $html.= '<input type="hidden" name="option" value="com_virtuemart"/>';
         $html.= '<input type="hidden" name="view" value="cart"/>';
            $html.= '<input type="hidden" name="price" value="'.$this->myprice.'"/>';
         $html.= '<noscript><input type="hidden" name="task" value="add"/></noscript>';
            $html.=  '<input type="hidden" class="quantity-input" name="quantity[]" value="1" />';
         $html.= '<input type="hidden" name="virtuemart_product_id[]" value="'.$product->virtuemart_product_id.'"/>';
         $html.= '<input type="hidden" name="virtuemart_category_id[]" value="'.$product->virtuemart_category_id.'"/>';
         $html.= '</form>';

Please anyone if you have any ideas on why all products in cart changes when i change modificatorsum please let me know.


Studio 42

If you want develop a simpler solution, you can use this customfield https://shop.st42.fr/en/products/shortcodes.htm and write your own very easier(you don't need to know VM or Joomla codding.
You can chek the 17 existing  shortcode plugins and write your own, so you dont have to mix 2 plugins.