Jump to content

Moving a Hook or module lower down


goody974

Recommended Posts

Hi

 

hope someone can help.

 

I have a module installed which upsells accessories.  by this I mean it adds the accessories into a section just below the product price on the product page.

 

The problem here is that this displays above the product options.  I would like to move it below the product options.  How can I do this?

 

An example can be seen at http://www.scalesworld.co.uk/parcel-scales/2-sw-a15-counting-scale.html

 

Also, when you click on add to cart, a tick appears in the accessory automatically, if you check the cart then the accessory hasnt been added, which is correct, but still this could cause unnecessary confusion.  Any way to stop this?

 

Thanks in advance

Link to comment
Share on other sites

Strange thing is this module makes no mention of this hook in its PHP file... simply:-

	function install()
	{
		if (!parent::install() || !$this->registerHook('extraRight'))
			return false;
		return true;
	}
	
	function hookExtraRight($params)
	{
		global $smarty, $cookie;
		if (isset($_GET['id_product'])) {
			$product = new Product(intval($_GET['id_product']));
			$accessories = $product->getAccessories(intval($cookie->id_lang));
			if ($accessories) {
				$smarty->assign(array('p_accessories' => $product->getAccessories(intval($cookie->id_lang))));
			}
		}
Link to comment
Share on other sites

Hard to tell, as it's triggered by javascript. Try looking for some reference like 

 

.product_accessories_description checkbox

 

 

It's triggering when you click the button, which has the following  reference:

 

<a class="exclusive" href="javascript:document.getElementById('add2cartbtn').click();">Add to cart</a>

  • Like 1
Link to comment
Share on other sites

Thanks for the pointer... it appears that this code triggers that in the upsell template:-

			ajaxCart.overrideButtonsInThePage_orig();
			$('body#product p#add_to_cart input').unbind("click").click(function() {
				ajaxCart.add( $('#product_page_product_id').val(), $('#idCombination').val(), true, null, $('#quantity_wanted').val(), null);
				
				$('#upsellaccessories ul li input[type="checkbox"]:checked').each(function (i,e) {
					$(e).parent().parent().children("a.hidden").trigger("click");
				})
				
				$('#upsellaccessories ul li input[type="checkbox"]').each(function (i,e) {
					$(e).attr("checked","");
				})
				
				return false;
			});

Removing the following line seems to make it work correctly:-

				$('#upsellaccessories ul li input[type="checkbox"]').each(function (i,e) {
					$(e).attr("checked","");
				})

Any harm in doing this?

Link to comment
Share on other sites

×
×
  • Create New...