VirtueMart Forum

VirtueMart 2 + 3 => Product pricing => Topic started by: johaswe on December 01, 2017, 12:54:12 pm

Title: Dynamic prices for photos
Post by: johaswe on December 01, 2017, 12:54:12 pm
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.

Title: Re: Dynamic prices for photos
Post by: Studio 42 on December 05, 2017, 00:18:05 am
If you want develop a simpler solution, you can use this customfield 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.