Jump to content

getting error using wishlist


Recommended Posts

I have been using the wishlist block successfully.  However, it is not working now after trying to move it around.  I am not sure if I broke it with adding and cascading of categories of if I changed something in one of the files.  When I click on the add to wishlist button on a product I get the error "Uncaught TypeError: Cannot read property 'value' of null".    I believe the error is coming from this call

 

onclick="WishlistCart('wishlist_block_list', 'add', '8', $('#idCombination').val(), document.getElementById('quantity_wanted').value); return false;"

 

specifically I believe $('#idCombination').val() is causing the issue.  When I look at my html that hidden value has no value.  Also I have testing doing an alert of the $('#idCombination').val() and I get the same error as my javascript console.

 

I have also tried replacing the modules folder in my theme with no luck.  I am using the default prestashop theme.

 

Any ideas would be appreciated.

 

Thank you.

Link to comment
Share on other sites

  • 1 year later...

Hi, 

Are you in catalogue mode? 

 

There is a problem with the quantities in this mode for the button.

 

can't find 'quantity_wanted' id 

document.getElementById('quantity_wanted').value);

I added some lines in my product.tpl file to solve this (at 353 line)

						<!-- quantity wanted -->
						{if !$PS_CATALOG_MODE}
						<div id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}>
							<a href="#" data-field-qty="qty" class="product_quantity_down button-minus">
								<i class="fa fa-caret-down"></i>
							</a>
							<input type="number" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" />
							
							<a href="#" data-field-qty="qty" class="product_quantity_up button-plus">
								<i class="fa fa-caret-up"></i>
							</a>
							<span class="clearfix"></span>
						</div>
						{else}
						<label for="quantity_wanted"></label>
						<input type="number" min="1" name="qty" id="quantity_wanted" style="display: none;" class="text" value="{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}" />
						{/if}
Edited by amicavi (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...