English - Cart contents is differend in ajax then on page load



  • I have a problem when I add a product to my cart, i see the product fly in the cart and the cart is filled.
    when I refresh the page (f5) then the cart is empty, when i add another product the BAM the items are in the basket again, on refres all gone again, BUT when I switch off js and add them directly while in the same session I get 2 differend cart contents, one when I use ajax and another when I refresh the page!

    try it here: https://tinyurl.com/shopkeeper3

    I use the same propertyset for ajax and non ajax.

    On my test site it works as expected:

    https://tinyurl.com/shopkeeper3-demo

    So I was wondering, How does shopkeeper know what cart to use? how is the cart stored?

    And what could cause this issue?



  • @Dimmy Please read the below instruction carefully:

    The first part - chunk empty basket of goods.
    The second part - chunk baskets with goods.
    
    data-shopcart="1" - is the mark, which is determined by a set of parameters for AJAX-updating of the cart.
    In the system settings (System Settings -> shopkeeper3) In the parameter "shk3.property_sets" you need to specify the names of the parameter sets (can be somewhat separated by commas)
    which are used on your website to the snippet Shopkeeper. It is necessary to synchronize with the AJAX-updating of the cart.
    Example shk3.property_sets = cart_catalog,cart_order_page
    In this case, the chunk (cartTpl), which is specified in the parameter set "cart_catalog" need to put a label data-shopcart="1".
    
    And chunk that is specified in the parameter set "cart_order_page" put a mark data-shopcart="2" (the serial number of the set of parameters).
    

    I suppose that you set different number values of data-shopcart parameter for the full and empty cart. They have to be the same in the chunk:

    <div class="shop-cart" data-shopcart="1">
        <div class="shop-cart-head"><b>Shopping cart</b></div>
        <div class="empty">
            <div class="shop-cart-empty">Empty</div>
        </div>
    </div>
    <!--tpl_separator-->
    <div class="shop-cart" data-shopcart="1">
        <div class="shop-cart-head"><b>Shopping cart</b></div>
        <div class="full">
            <div  style="text-align:right;">
                <a href="[[+empty_url]]" id="shk_butEmptyCart">Clear cart</a>
            </div>
            <div class="shop-cart-body">Selected: <b>[[+items_total]]</b> [[+plural]]</div>
            <div style="text-align:right;">Total price: <b>[[+price_total]]</b> [[+currency]]
            </div>
            <div class="cart-order">
                <a href="[[+order_page_url]]" id="shk_butOrder">Checkout</a>
            </div>
        </div>
    </div>
    
    A chunk is composed of two parts separated by a special delimiter <!--tpl_separator-->
    


  • This is my chunk: as tou can see both have the same numer:

    <div class="shop-cart" data-shopcart="2">
        <div class="shop-cart-head"><b>Mandje</b></div>
        <div class="empty">
            <div class="shop-cart-empty">Mandje is leeg - [[+order_page_url]]</div>
        </div>
    </div>
    <!--tpl_separator-->
    <div class="shop-cart" data-shopcart="2">
        <div class="shop-cart-head"><a name="shopCart"></a><b>Mandje - [[+order_page_url]]</b></div>
        <div class="full">
            <form action="[[+this_page_url]]#shopCart" method="post">
            <fieldset>
                <div  style="text-align:right;">
                    <a href="[[+empty_url]]" id="shk_butEmptyCart">Mandje legen</a>
                </div>
                <table width="100%">
                    <colgroup>
                        <col width="40%" />
                        <col width="25%" />
                        <col width="25%" />
                        <col width="10%" />
                    </colgroup>
                    <tbody>
                        [[+inner]]
                    </tbody>
                </table>
                <div  style="text-align:right;">
                    Verzending: [[+delivery_name]] ([[+delivery_price]] [[+currency]])
                </div>
                <div  style="text-align:right;">
                    totaal bedrag: <b>[[+price_total]]</b> [[+currency]]
                </div>
                <noscript>
                    <div><input type="submit" name="shk_recount" value="recalculate" /></div>
                </noscript>
                <div class="cart-order">
                    <a href="[[+order_page_url]]" class="button hollow" id="shk_butOrder">Betalen</a>
                </div>
            </fieldset>
            </form>
        </div>
    </div>
    

    And as I understand this is only for the propertyset that is used, in my case 1 and 2 are the same. I changed them to 1 and to to 2 with the same results.

    this is my snippet call: [[!Shopkeeper3@sk-nl]]

    this is my propertyset:

    allowFloatCount		No
    animCart		Yes
    cartRowTpl		@FILE shopCartRow.tpl
    cartTpl			@FILE shopCart.tpl
    changePrice		Yes
    className		modResource
    counterField		No
    counterFieldCart	Yes
    currency		EUR
    debug			Yes
    excepDigitGroup		Yes
    fieldPrice		product.price
    flyToCart		helper
    fromParentHeight	1
    fromParentList	
    goToOrderFormPage	No
    groupBy	
    hideOn	
    jsScript		1
    lang	nl
    noConflict		Yes
    noCounter		No
    noJQuery		Yes
    noLoader		No
    orderDataTpl		@FILE orderData.tpl
    orderFormPageId		6430
    packageName	
    pluralWords	
    processParams		0
    prodCont		div.shk-item
    savePurchasesFields	
    style			default
    tplPath			../core/components/shopkeeper3/elements/chunks/nl/
    

    And this are my system settings (set in context settings its a multy languange site)

    shk3.currency
    shk3.currency
    EUR
    —
     
    shk3.currency_default
    shk3.currency_default
    1
    —
     
    shk3.first_status
    shk3.first_status
    1
    —
     
    shk3.mail_contacts_row_tpl
    shk3.mail_contacts_row_tpl
    mailContactsRow
    —
     
    shk3.mail_order_data_row_tpl
    shk3.mail_order_data_row_tpl
    orderDataRow
    —
     
    shk3.mail_order_data_tpl
    shk3.mail_order_data_tpl
    orderDataOuter
    —
     
    shk3.property_sets
    shk3.property_sets
    sk-nl,sk-nl
    


  • @Dimmy I'm not sure if it works with multilanguage sites...

    You could try to set data-shopcart="1" and to set the shk3.property_sets = sk-nl in the system setings (not context) and test if it is working or not.



  • This makes no difference, Do you know how and where the basket is saved? maybe I cab figger it out from there.



  • @Dimmy purchases are stored somewhere in $_SESSION check the shk_fihook



Последние темы

Похоже, подключение к Форум | MODX Shopkeeper было разорвано, подождите, пока мы пытаемся восстановить соединение.