remove mootools modal.js squeezebx,except checkout

  • Posts: 154
  • Thank you received: 4
10 years 10 months ago #162151

-- HikaShop version -- : 2.3.1
-- Joomla version -- : 3.3.1

dear team, since installing hikashop on the site, some scripts are being loaded and cause problems. i found many information in the forum and managed to disable some of them (= mootools) on the site. still its kind of buggy.

for example modal.js and squeezebox are still being loaded on all pages except the checkout pages!!!
how can this be? it was not like that before installing hikashop... no modal.js , no squeezebox at all!

i understand that mootools is needed for shipping / payment method selections, address changes in the user control panel etc.
so basically it would be easier if there was an option to remove mootools/modal.js/squeezebox from all pages except the ones related with the checkout process...

can this be done?

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
10 years 10 months ago #162190

Hi,

That's already the case. Mootools, modal, etc are only loaded when necessary. But if you have add to cart buttons, they will be loaded as they are needed for the add to cart. And since they are needed in the checkout, you pretty much see them loaded most of the HikaShop pages.

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 10 months ago #162221

thanks for the quick reply.
thats good news, but there must be something wrong with my setup then...
please check the page (see pm), there is no cart, or buttons on there but modal.js and hikashop.js is being loaded...

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
10 years 10 months ago #162225

Hi,

The add to cart buttons javascript is added on the page (see the source of the page, you'll find the function hikashopModifyQuantity in the header of the page) and this javascript requires mootools/modals in order to work.
This indicates that the function getJS of the file administrator/components/com_hikashop/helpers/cart.php is called by something on that page, and that's where the mootools/modal libraries are loaded, together with the hikashopModifyQuantity function.

The best would be to add a line:
var_dump(debug_backtrace());
just after the line:
function getJS($url,$needNotice=true){
in that file.
That way, you would get a dump of all the call stack and we'll be able to tell you what is calling that function on that page if you copy/paste us that call stack dump.

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 10 months ago #162494

unfortunately this breaks my firefox...
been unresponsive for ever...
but you are right, the load of those scripts is caused by the cart-module... even if this is empty...
i disabled it and all scripts gone...

is there any way to load only minicart info and link to cart without all the js???

is it easy to build a custom module displaying only the amount of products, the sum and the link to cart?
can you please give me some hints here?


and in the "online shop" > "checkout" i get a "ReferenceError: Hash is not defined" in modal.js
is that normal???

Last edit: 10 years 10 months ago by olivnewton.

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 10 months ago #162515

never mind, i quickly build my own mini cart with sourcerer and some php...
but this is still bugging me: "online shop" > "checkout" i get a "ReferenceError: Hash is not defined" in modal.js

if anybody is interested here is my solution with a custom html module and sourcerer (its a nonumber joomla extension):
(still, i am interested if there is a simpler solution to this = mini cart without all the JS clutter...)
(AND: maybe you can have a look and tell me if there is something i could optimize, or maybe i didnt think of?)

{source}
<?php

$session =& JFactory::getSession();
$session_id = $session->getId();

//-----

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('cart_id');
$query->from($db->quoteName('#__hikashop_cart'));
$query->where($db->quoteName('session_id')." = ".$db->quote($session_id));

$db->setQuery($query);
$cart_id = $db->loadResult();

//-----

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(array('product_id', 'cart_product_quantity'));
$query->from($db->quoteName('#__hikashop_cart_product'));
$query->where($db->quoteName('cart_id')." = ".$db->quote($cart_id));

$db->setQuery($query);
$cart = $db->loadAssocList();

//print_r($cart);

//-----

$i = 0;
foreach ($cart as $row)
{

$product_id = $row['product_id'];

$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('price_value');
$query->from($db->quoteName('#__hikashop_price'));
$query->where($db->quoteName('price_product_id')." = ".$db->quote($product_id));

$db->setQuery($query);
$price = $db->loadResult();

$items = $row['cart_product_quantity'];
$price = round($price*$items*1.07,2);

$cart[$i]['price'] = $price;
$i++;

}

//print_r($cart);

//-----

foreach ($cart as $row)
{

$totalitems += $row['cart_product_quantity'];
$totalprice += $row['price'];

}

if ($totalitems > 0)
{

echo $totalitems.' Artikel für '.number_format($totalprice, 2, ',', '.').' €<br>';
echo '<a href="/bestellvorgang/checkout/">Zur Kasse</a>';

}
else
{

echo 'Ihr Warenkorb ist leer!';

}

?>
{/source}

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
10 years 10 months ago #162505

Hi,

Remove the code:

ob_start();
		$cart->getJS($url,false);
		$notice_html = ob_get_clean();
		$this->assignRef('notice_html',$notice_html);
from the file components/com_hikashop/views/product/view.html.php and that should remove the loading of the add to cart js for the cart module.
That will be the easiest.

Hash is not defined happens because of a conflict between mootools and jquery. In such cases, we usually recommend to install and configure the plugin jquery easy which often fixes such error. But if it doesn't causes any problem, I guess to can keep it like that.

The following user(s) said Thank You: olivnewton

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 10 months ago #162594

thanks! removing the code worked.
but there still is the problem with no title of module showing up! (= see my thread in www.hikashop.com/forum/checkout/868524-f...checkout.html#161914 ) ... any news there?

in case of no, i might use my custom-html-module-code for the time being (as the title shows up there), but it would be nicer to rely 100% on hikashop...

as for the HASH NOT DEFINED:
i made the following changes with JQUERY EASY plugin in order for the error to disappear as it wouldnt work out-of-the-box:
Advanced Site Options > Strip Remaining Scripts
"/media/system/js/modal.js"
...maybe there is even a better way of doing this with JQUERY EASY???

...is the way i did it OK, or might there be somewhere a conflict in the checkout process this way???
(= i am just experiencing some weird problems with checkout, like, if i jump back in the progress bar, or if i continue shopping during the checkout process and then come back it asks sometimes for completion of elements 2-3 times (even if i entered this = for example "shipping info") and then after 2nd or 3rd time i can continue to next step. this also happens after finishing a purchase, and then adding new items to an empty cart, and then trying to purchase them, with the same data (adress etc.)...) it looks like there is some trouble with the session???) = should i open here a new topic or is this problem connected to JQUERY EASY ???

Last edit: 10 years 10 months ago by olivnewton.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #162629

Hi,

It seems to be ok as long as you don't have the value "popup" selected for the option "Address selector".
Regarding the title, I just answered on your other topic.

For the "session" problem, we made many fixes about that. They will be available in the next release.

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 10 months ago #162770

great, thanks!

when is the next release planned?

we are currently finishing up one site with hikashop (within the next 2 weeks)
another one is in development (due end of july)
and one more is coming up for until september...

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #162773

Hi,

We can't give a precise date, but it should be within next 2 weeks, but nothing sure. ;)

The following user(s) said Thank You: olivnewton

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 10 months ago #163407

has this been fixed in 2.3.2? i couldnt find anything about it in changelog...

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #163409

Hi,

Yes the session problems are presents in the 2.3.2. It's not mentioned as session issue, but more related on the cart, etc.

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 10 months ago #163673

i see. so the next couple of weeks will be another update addressing this issues?

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #163677

Hi,

Sorry, my last sentence was not correct.

Yes the session problems corrections are presents in the 2.3.2


And the 2.3.2 is already available, you can download it from our website.

The following user(s) said Thank You: olivnewton

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 10 months ago #163791

great news, thanks!

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 7 months ago #175960

sorry i had to revive this:

i removed the code as suggested:

ob_start();
$cart->getJS($url,false);
$notice_html = ob_get_clean();
$this->assignRef('notice_html',$notice_html);

from the file components/com_hikashop/views/product/view.html.php

and also in "Shipping & Payment" "Address selector" is set to "Dropdown list" ... as suggested

but in CHECKOUT > ADRESS (with guest login) the "ReferenceError: SqueezeBox is not defined" JS error still appears.
Only there, everywhere else on the site, no matter if CHECKOUT, ONLINESHOP or not its gone for good...
Do i maybe need to remove the above code also in another file???

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
10 years 7 months ago #175985

Hi,

Can you provide a link to that shop so that we can see the error and analyze it on your checkout ?

Please Log in or Create an account to join the conversation.

  • Posts: 154
  • Thank you received: 4
10 years 7 months ago #176194

sure. thanks. i PMed you the link.
the way to reproduce the error is:
1. add a book to cart
2. go through all steps but do not purchase at the end!
3. revisit the home page
4. re enter the cart (top right under the banner)
5. click NEXT
6. now as entering the ADRESS-Step the JS error occurs...

Please Log in or Create an account to join the conversation.

  • Posts: 83832
  • Thank you received: 13572
  • MODERATOR
10 years 7 months ago #176348

Hi,

Ok. Remove the line:
JHTML::_('behavior.modal');
from the function address() of the file components/com_hikashop/views/checkout/view.html.php and that should avoid that error.

Please Log in or Create an account to join the conversation.

Time to create page: 0.100 seconds
Powered by Kunena Forum