WebSite X5Help Center

 
C. M.
C. M.
User

X5engine.cart.manager: object is null  en

Autor: C. M.
Visited 1408, Followers 2, Udostępniony 0  

A quick question on the x5engine.cart.manager object:

When calling the x5engine.cart.manager.add() method from within an html button (see code snippet #1), all works fine and the product is added to the cart.

When calling the same method from within a custom html object (see code snippet #2), I get the following error (copy from the browser console) : “TypeError: x5engine.cart.manager is null”.

How can I instantiate the x5engine.cart.manager so that I can use the object through a custom object directly?

Thanks for your support.

C.M.

Snippet #1:

<input type="button" value="add to cart" onclick="atc()" />

<script>

function atc() {

x5engine.cart.manager.add('x9zp4mzf’, 1);

}

</script>

Snippet #2:

<script>

x5engine.cart.manager.add('x9zp4mzf’, 1);

</script>

Posted on the
3 ODPOWIEDZI - 1 PRAWIDłOWA ODPOWIEDź
C. M.
C. M.
User
Autor

Thanks. It is a sligthly different approach, might be indeed helpful.

I will check it out and come back in a few days.

Czytaj więcej
Posted on the from C. M.
C. M.
C. M.
User
Autor

Sorry for the delayed confirmation. Just for the record, the approach that Ricardo recommended works.

Thanks.

Czytaj więcej
Posted on the from C. M.