VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: cjsmiff on March 07, 2019, 22:47:17 PM

Title: Product prices not updating in Category View
Post by: cjsmiff on March 07, 2019, 22:47:17 PM
Hi,

I have a problem in that the price does not update on the Category View page when an option that costs more than the base price is selected.

Product Page.. everything works as expected.
https://www.cooksroom.co.uk/2demo/zola-matte-paint-to-order-true-handleless/high-line-base-units.html (https://www.cooksroom.co.uk/2demo/zola-matte-paint-to-order-true-handleless/high-line-base-units.html)

Any idea how I can fix this on the Category View page please?

I have only 2 template overrides (Sublayouts - products_horizon.php and products_slim.php) and have tried removing these. I have also tried changing my template to the Joomla default and the problem is the same.

I am using VM 3.4.2 with Joomla 3.9.3.

Kind Regards
Claire  :D
Title: Re: Product prices not updating in Category View
Post by: GJC Web Design on March 07, 2019, 23:09:20 PM
you have a huge number of change events attached to the select and the ajax call doesn't fire at all

on standard vm I only see 2 -- vmprices and jq

try disabling customfields for all and your menu

why have all that js junk for a simple dropdown menu? .. just use some css
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on March 17, 2019, 00:01:01 AM
Hi,

Thank you for your reply. The menu came with the Joomla template but the price changes don't work using the default Joomla template either.

I have just done a test using a string custom field and disabled the custom fields for all but the result is the same. The prices do not update on the product listing pages, they do update on the actual product page.

The tests you suggested I had already performed before posting here.

:)
Title: Re: Product prices not updating in Category View
Post by: jenkinhill on March 17, 2019, 14:31:48 PM
Have you selected "Cart Input" for your custom field configuration?
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on March 17, 2019, 15:55:28 PM
Hi Jenkinhill,

Yes, customs fields have cart input set.  :D
Title: Re: Product prices not updating in Category View
Post by: Jörgen on March 17, 2019, 19:50:39 PM
You have an template error, You are missing the class "product-container" in your category view.

Jörgen @ Kreativ Fotografi
Title: Re: Product prices not updating in Category View
Post by: jjk on March 17, 2019, 20:36:31 PM
Looks to me like the old 'Forte' template by Shape5, bundled with some third-party-addons of which some are dating back as far as 2012.
Did you get your template here? https://www.joomlart.com/member/downloads/shape5/free-joomla-templates/s5-forte
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on March 18, 2019, 23:27:47 PM
Quote from: Jörgen on March 17, 2019, 19:50:39 PM
You have an template error, You are missing the class "product-container" in your category view.

Jörgen @ Kreativ Fotografi

Bingo! Thank you!  :D

Except! That I can't figure out where to put it in the category/default.php file, everywhere I try it makes the prices update but it changes all other product prices to the same price too.

Any ideas where I should put it please? :D :D
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on March 18, 2019, 23:30:18 PM
Quote from: jjk on March 17, 2019, 20:36:31 PM
Looks to me like the old 'Forte' template by Shape5, bundled with some third-party-addons of which some are dating back as far as 2012.
Did you get your template here? https://www.joomlart.com/member/downloads/shape5/free-joomla-templates/s5-forte

Hi JJK,

Many thanks for you reply. Yes, you are right but my initial problem here is now solved.
Thanks again  :D :D :D
Title: Re: Product prices not updating in Category View
Post by: Jörgen on March 19, 2019, 06:50:29 AM
Glad You could solve it.

Jörgen @ Kreativ Fotografi
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on April 12, 2019, 00:54:13 AM
 :( Unfortunately this isn't fixed, I couldn't find the right place to put the class "product-container" in category view. All my attempts ended up changing all of the prices on all of the products on the page to the price selected.

I have tried various different templates including Joomla's included Beez3 & protostar, plus a couple of paid templates but the problem persists! I'm not sure that it is template related having tried so many other templates.

Any more ideas please?
:)
Title: Re: Product prices not updating in Category View
Post by: jenkinhill on April 12, 2019, 12:13:51 PM
Have a look at http://demo.virtuemart.net/  - this uses a styled version of Beez and VirtueMart default templates. Product prices update as expected.

The complete installation as used in the demo is available at http://dev.virtuemart.net/attachments/download/1159/com_virtuemart.3.4.5.10040_package_or_extract.zip
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on April 14, 2019, 22:51:35 PM
Quote from: jenkinhill on April 12, 2019, 12:13:51 PM
Have a look at http://demo.virtuemart.net/  - this uses a styled version of Beez and VirtueMart default templates. Product prices update as expected.

The complete installation as used in the demo is available at http://dev.virtuemart.net/attachments/download/1159/com_virtuemart.3.4.5.10040_package_or_extract.zip

Hi, thank you again.

I am now working from a copy of my site here: https://www.cooksroom.co.uk/3demo/cornell-classic-alabaster/high-line-base-units-c-1.html
I have set Beez as the default Joomla Template and am playing around with VM configuration settings but still no joy. I enabled the VM Debug which gave me this:


        1 vmdebug 1 Language, default shoplanguage (VmConfig::$jDefLang): en_gb en-GB
        2 vmdebug vmTime: time to load config: 0.00742197036743164
        3 vmdebug There is no requested itemid loaded home Itemid Var1:

        101

        4 vmdebug getCategory 1880 1
        5 vmdebug my vars from router Var1:

        Array
        (
            [limitstart] => 0
            [virtuemart_category_id] => 1880
            [view] => category
            [limit] => 24
        )

        6 vmdebug Start used Ram 12M
        7 vmdebug getCategory 1880 0
        8 vmdebug Use already loaded category with children
        9 vmdebug getVendorId normal shopper
        10 vmdebug My Memory Limit in Bytes 1048576000
        11 vmdebug getCategory 1880 1
        12 vmdebug Found cached cat
        13 vmdebug my filter order Var1:

        product_name

        14 vmdebug getCategory 1880 1
        15 vmdebug Found cached cat
        16 vmdebug $limitStart Var1:

        0

        17 vmdebug vmTime: sortSearchQuery products: : 0.00198888778686523
        18 vmdebug SSL enabled
        19 vmdebug my filter order Var1:

        product_name

        20 vmdebug vmTime: sortSearchQuery products: featured: 0.000644922256469727
        21 vmdebug my filter order Var1:

        product_name

        22 vmdebug vmTime: sortSearchQuery products: discontinued: 0.000460147857666016
        23 vmdebug Set 0 to 0
        24 vmdebug isSuperVendor Not a vendor 0 Var1:

        0

        25 vmdebug getCategory 1877 0
        26 vmdebug End used Ram 24M
        27 vmdebug Peak memory peak 24M
        28 vmdebug vmTime: "VirtuemartControllerCategory" Finished task : 0.230931997299194
        29 vmdebug Use cache for mod products
        30 vmdebug my filter order Var1:

        product_name

        31 vmdebug vmTime: sortSearchQuery products: featured: 0.000620841979980469
        32 vmdebug my filter order Var1:

        product_name

        33 vmdebug vmTime: sortSearchQuery products: featured: 0.000417947769165039

Does this shed any light? It doesn't for me!
I'm just about to try overwriting the core files with the files from the download link you supplied, again Thank you.

Title: Re: Product prices not updating in Category View
Post by: cjsmiff on April 14, 2019, 23:31:58 PM
Installed the package as per your link jenkinhill and now using vmbeez3 for the shop template, category template and main Joomla template but still no joy: https://www.cooksroom.co.uk/3demo/cornell-classic-alabaster/high-line-base-units-c-1.html

Curiously!!! I have set 2 of the products to be Featured Products on this page and the prices update as they should do in the Module!! So, what is wrong in my component display area? I have nooooo idea!  :-\
Title: Re: Product prices not updating in Category View
Post by: Jörgen on April 15, 2019, 05:32:38 AM
Cache problem ? Turn off cache and joomla cache plugin and clear cache to test.

Jörgen @ Kreativ Fotografi
Title: Re: Product prices not updating in Category View
Post by: jenkinhill on April 15, 2019, 11:46:21 AM
The custom field code displayed on the page is different between the category view product and the Featured Product. The code on the Product Details page is similar to this first example - and for some treason it works there....

Code for category view:

<div class="vm-customfields-wrap">
<div class="product-fields">
<div class="product-field product-field-type-E">
<span class="product-fields-title-wrapper"><span class="product-fields-title"><strong>Size:</strong></span>
</span>
<div class="product-field-display">






<script id="updateChosen-js" type="text/javascript">//<![CDATA[
if (typeof Virtuemart === "undefined")
var Virtuemart = {};
Virtuemart.updateChosenDropdownLayout = function() {
var vm2string = {editImage: 'edit image',select_all_text: 'Select all',select_some_options_text: 'Available for all'};
jQuery("select.vm-chzn-select").chosen({enable_select_all: true,select_all_text : vm2string.select_all_text,select_some_options_text:vm2string.select_some_options_text,disable_search_threshold: 5});
//console.log("updateChosenDropdownLayout");
}
jQuery(document).ready( function() {
Virtuemart.updateChosenDropdownLayout($);
}); //]]>
</script>
<script id="vm-countryState-js" type="text/javascript">//<![CDATA[
jQuery(document).ready( function($) {
$("#virtuemart_country_id_field").vm2front("list",{dest : "#virtuemart_state_id_field",ids : "",prefiks : ""});
}); //]]>
</script>
<script id="vm-countryStateshipto_-js" type="text/javascript">//<![CDATA[
jQuery(document).ready( function($) {
$("#shipto_virtuemart_country_id_field").vm2front("list",{dest : "#shipto_virtuemart_state_id_field",ids : "",prefiks : "shipto_"});
}); //]]>
</script>

<script id="ready.vmprices-js" type="text/javascript">//<![CDATA[
jQuery(document).ready(function($) {

Virtuemart.product($("form.product"));
}); //]]>
</script>

<div class="cf4all_wrapper  cf4all_required" id="cf4all_wrapper_22328_">
<span class="cf4all_error_msg" style="display:none">Please select an option!</span>
<select id="customProductData912622328customsforall_option" name="customProductData[91][26][22328][customsforall_option]">
<option value="0" selected="selected">Select</option>
<option value="43">700mm</option>
<option value="44">800mm&nbsp;(+&pound;10.13)</option>
<option value="45">900mm&nbsp;(+&pound;19.61)</option>
<option value="46">1000mm&nbsp;(+&pound;30.71)</option>
<option value="47">1200mm&nbsp;(+&pound;51.13)</option>
</select>
</div>
</div> </div>


Code for featured product module:

<div class="vm-customfields-wrap">
<div class="product-fields">
<div class="product-field product-field-type-E">
<span class="product-fields-title-wrapper"><span class="product-fields-title"><strong>Size:</strong></span>
</span>
<div class="product-field-display">
<div class="cf4all_wrapper  cf4all_required" id="cf4all_wrapper_22328_">
<span class="cf4all_error_msg" style="display:none">Please select an option!</span>
<select id="customProductData912622328customsforall_option" name="customProductData[91][26][22328][customsforall_option]">
<option value="0" selected="selected">Select</option>
<option value="43">700mm</option>
<option value="44">800mm&nbsp;(+&pound;10.13)</option>
<option value="45">900mm&nbsp;(+&pound;19.61)</option>
<option value="46">1000mm&nbsp;(+&pound;30.71)</option>
<option value="47">1200mm&nbsp;(+&pound;51.13)</option>
</select>
</div>
</div> </div>
[/div]


Both customs are of type E - ie they use a plugin

VM default custom field demo is type S  - a string

This is the code from a VM demo category view of a product with one price variant  - it is much simpler than your code - and works.

<div class="vm-customfields-wrap">
<div class="product-fields">
<div class="product-field product-field-type-S">
<span class="product-fields-title-wrapper"><span class="product-fields-title"><strong>String, admin list</strong></span>
<span class="hasTooltip" title="&lt;strong&gt;String, admin list&lt;/strong&gt;&lt;br /&gt;Select a variant"><img src="/VM34/media/system/images/tooltip.png" alt="Tooltip" /></span></span>
<div class="product-field-display"><select name="customProductData[162][14]" class="vm-chzn-select">
<option value="454">Standard No additional charge</option>
<option value="455">Waxed +&pound;10.35</option>
</select>
</div> </div>
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on April 15, 2019, 14:32:10 PM
Quote from: Jörgen on April 15, 2019, 05:32:38 AM
Cache problem ? Turn off cache and joomla cache plugin and clear cache to test.

Jörgen @ Kreativ Fotografi

Hi, Joomla system cache is already off as is the plugin System Page Cache (it's the only cache plugin I could find..?). Cleared cache and tested... still the same.
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on April 15, 2019, 14:36:41 PM
Quote from: jenkinhill on April 15, 2019, 11:46:21 AM
The custom field code displayed on the page is different between the category view product and the Featured Product. The code on the Product Details page is similar to this first example - and for some treason it works there....

Code for category view:

<div class="vm-customfields-wrap">
<div class="product-fields">
<div class="product-field product-field-type-E">
<span class="product-fields-title-wrapper"><span class="product-fields-title"><strong>Size:</strong></span>
</span>
<div class="product-field-display">






<script id="updateChosen-js" type="text/javascript">//<![CDATA[
if (typeof Virtuemart === "undefined")
var Virtuemart = {};
Virtuemart.updateChosenDropdownLayout = function() {
var vm2string = {editImage: 'edit image',select_all_text: 'Select all',select_some_options_text: 'Available for all'};
jQuery("select.vm-chzn-select").chosen({enable_select_all: true,select_all_text : vm2string.select_all_text,select_some_options_text:vm2string.select_some_options_text,disable_search_threshold: 5});
//console.log("updateChosenDropdownLayout");
}
jQuery(document).ready( function() {
Virtuemart.updateChosenDropdownLayout($);
}); //]]>
</script>
<script id="vm-countryState-js" type="text/javascript">//<![CDATA[
jQuery(document).ready( function($) {
$("#virtuemart_country_id_field").vm2front("list",{dest : "#virtuemart_state_id_field",ids : "",prefiks : ""});
}); //]]>
</script>
<script id="vm-countryStateshipto_-js" type="text/javascript">//<![CDATA[
jQuery(document).ready( function($) {
$("#shipto_virtuemart_country_id_field").vm2front("list",{dest : "#shipto_virtuemart_state_id_field",ids : "",prefiks : "shipto_"});
}); //]]>
</script>

<script id="ready.vmprices-js" type="text/javascript">//<![CDATA[
jQuery(document).ready(function($) {

Virtuemart.product($("form.product"));
}); //]]>
</script>

<div class="cf4all_wrapper  cf4all_required" id="cf4all_wrapper_22328_">
<span class="cf4all_error_msg" style="display:none">Please select an option!</span>
<select id="customProductData912622328customsforall_option" name="customProductData[91][26][22328][customsforall_option]">
<option value="0" selected="selected">Select</option>
<option value="43">700mm</option>
<option value="44">800mm&nbsp;(+&pound;10.13)</option>
<option value="45">900mm&nbsp;(+&pound;19.61)</option>
<option value="46">1000mm&nbsp;(+&pound;30.71)</option>
<option value="47">1200mm&nbsp;(+&pound;51.13)</option>
</select>
</div>
</div> </div>


Code for featured product module:

<div class="vm-customfields-wrap">
<div class="product-fields">
<div class="product-field product-field-type-E">
<span class="product-fields-title-wrapper"><span class="product-fields-title"><strong>Size:</strong></span>
</span>
<div class="product-field-display">
<div class="cf4all_wrapper  cf4all_required" id="cf4all_wrapper_22328_">
<span class="cf4all_error_msg" style="display:none">Please select an option!</span>
<select id="customProductData912622328customsforall_option" name="customProductData[91][26][22328][customsforall_option]">
<option value="0" selected="selected">Select</option>
<option value="43">700mm</option>
<option value="44">800mm&nbsp;(+&pound;10.13)</option>
<option value="45">900mm&nbsp;(+&pound;19.61)</option>
<option value="46">1000mm&nbsp;(+&pound;30.71)</option>
<option value="47">1200mm&nbsp;(+&pound;51.13)</option>
</select>
</div>
</div> </div>
[/div]


Both customs are of type E - ie they use a plugin

VM default custom field demo is type S  - a string

This is the code from a VM demo category view of a product with one price variant  - it is much simpler than your code - and works.

<div class="vm-customfields-wrap">
<div class="product-fields">
<div class="product-field product-field-type-S">
<span class="product-fields-title-wrapper"><span class="product-fields-title"><strong>String, admin list</strong></span>
<span class="hasTooltip" title="&lt;strong&gt;String, admin list&lt;/strong&gt;&lt;br /&gt;Select a variant"><img src="/VM34/media/system/images/tooltip.png" alt="Tooltip" /></span></span>
<div class="product-field-display"><select name="customProductData[162][14]" class="vm-chzn-select">
<option value="454">Standard No additional charge</option>
<option value="455">Waxed +&pound;10.35</option>
</select>
</div> </div>


Hi jenkinhill, I have also tried disabling CustomFields4All and using String for the options instead but the result is the same and the prices do not update.  :(
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on April 17, 2019, 23:51:28 PM
Ok, so I have done a fresh install of Joomla 3.9.5 and VM 3.4.5, I have set the Joomla Template as vmbeez3. Next I imported the products from my previous test site (3demo), I have disabled Custom Fields For All and created a Test Product using String for the options but the result is still the same: https://www.cooksroom.co.uk/4demo/cornell-classic-alabaster/high-line-base-units-c-1.html

The prices just do not want to update!  :'(
Title: Re: Product prices not updating in Category View
Post by: cjsmiff on April 19, 2019, 01:42:51 AM
Solved! Thanks to:
Quote from: Jörgen on March 17, 2019, 19:50:39 PM
You have an template error, You are missing the class "product-container" in your category view.

Jörgen @ Kreativ Fotografi

I finally found where to add this class! https://www.cooksroom.co.uk/2demo/zola-matte-paint-to-order-true-handleless/high-line-base-units.html

In products_slim on line 178 I changed:
<div class="product <?php echo $cellwidth.$show_vertical_separator ?>">
to
<div class="product-container <?php echo $cellwidth.$show_vertical_separator ?>">

Hooray! Thank you very much to everyone for their input!