Announcement

Collapse
No announcement yet.

Get the cart items in javascript

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Get the cart items in javascript

    Hi,

    i am trying to get the cart items and their details like the product name, price, quantity for each item that is in the shopping cart in javascript.

    It must be there because sellerdeck has a function to get the number of the items, getCartItem(3)

    Has anyone ever came across this?

    Thank you.

    #2
    You basically want the view cart layout. do you want to show it in a Light Box or something?

    Tell us what you are trying to achieve and we may be better placed to help.
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    Comment


      #3
      Hi Jonathan,

      i am actually trying to implement google analytics ecommerce tracking but the enhanced one, not the standard one (https://developers.google.com/analyt...nced-ecommerce)

      Sellerdeck does not support this, they only support the standard one where you just put your google analytics id and it works by it self with addItems and addTransaction.

      I am trying to implement the enhanced method where it keeps track of all the pages and product views and all the steps through the checkout.

      So, i want to get the cart items in javascript to send them as parameters to some google methods that will be called to each step of the checkout proccess

      Comment


        #4
        must be there because sellerdeck has a function to get the number of the items
        Afraid not. The Cart scripts have code to put just the cart total and the number of items into a cookie so it can be retrieved on all pages. The Cart contents aren't available on normal HTML pages. You can only get the Cart contents on the Cart, Checkout and Receipt pages. These pages are generated by Perl and it's only the Perl that has access to the Cart (which is stored in a .Session file on the server).

        If getting the Cart details on the Cart, Checkout and Receipt pages is enough for your needs, then you may be able to get all you need. I did an integration of Google Trusted Stores (aka Google Certified Shops) with SellerDeck and I had to tweak these SD layouts (n.b. weeks of work):

        Shopping Cart Product Details / Cart Product Details
        Shopping Cart Product Details / Cart Product Details With Thumbnails RWD
        Shopping Cart Table / Checkout Shopping Cart Grid
        Shopping Cart Table Row / Adjustment Row
        Shopping Cart Table Row / Product Line Row

        And write 7 new layouts that picked up other bits of product and cart related info. The reason for this complexity is that the Perl used to create the Cart scripts iterate over each product in the Cart and use different Layouts as templates for generating the HTML that you see when looking at the Cart. For example in layout Cart Product Details, you'll see:
        Code:
        <Actinic:XMLTEMPLATE NAME="ProductLine">
        .
        .
        .
        </Actinic:XMLTEMPLATE>
        These tags are used by the Cart Perl and indicate an area that contains Product Line details. So variables between these tags (e.g. ProductNameOnline) will probably only work there.

        Another route that may be worth investigating would be to use jQuery to iterate over the Cart and extract data. Layout Shopping Cart Table Row has a TR for each row in the Cart. Add a classname there and you can then locate all rows in the Cart. Within these rows is layout Cart Product Details - add classnames to each TD of interest and you can now access the individual items.

        Be prepared for lots of "gotcha's" - the cart also contains lines for Component, Adjustments, etc..
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          thank you Norman,

          i will try some stuff and let you know.

          It is only in those pages that i need the details, shopping cart, checkout pages and the receipt page

          Comment

          Working...
          X