Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Flavio Spezi 128 posts 314 karma points
    Aug 25, 2016 @ 16:12
    Flavio Spezi
    0

    Add product to Basket without create it in Products Catalogue

    I am developing an eCommerce website where user will be customize the salable product. Then I would not use the build-in Merchello product catalogue.

    I would add a product to Basket, but I would not add it in Products Catalogue.

    How can I do it?

    I'm using Merchello 2.1.0 with Umbraco 7.4.3, but I can upgrade theese.

    I had solved it in Merchello 1.8.3.
    The solution is to use a signle catalogue product (sku: "UniqueProduct").
    Then execute basket.AddItem to add the product to basket.
    Then get last item from basket, and update item data: name, description, sku, price, weight, and so on.

    But this solution does not works in Merchello 2.1.0:

    • it is not possible to add the second product to Basket because Merchello already found the same product.
    • the price of basket item is updated with the "UniqueProduct" price when procedure execute "basket.GetCheckoutManager()".

    Thanks.

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Aug 25, 2016 @ 16:58
    Rusty Swayne
    100

    Hi Flavio,

    I think you might be running into a validation issue (introduced in 1.11.0) - Can you try removing the validation tasks in the merchello.config file ...

           <taskChain alias="ItemCacheValidation">
      <!-- Added Merchello Version 1.11.0
      This chain validates basket and wish list items against values in the back office to assert that the customer has not
      added items to their basket that were subsequently changed in the back office prior to checkout.  The process is needed
      as the relation between the basket and wish list items are decoupled from the actual persisted values.
      -->
        <tasks>
            <task type="Merchello.Web.Validation.Tasks.ValidateProductsExistTask, Merchello.Web" />
            <!--
                The following task is intended to assert that pricing and/or on sale value has not changed in the back office since the
                customer has placed an item into their basket or wish list. If you have made custom pricing modifications in your
                implementation, you may either remove this task or adjust your code to add a new extended data value
                merchLineItemAllowsValidation = false
                to the line item so that it is skipped in the validation process.
            -->
            <task type="Merchello.Web.Validation.Tasks.ValidateProductPriceTask, Merchello.Web" />
            <!--
                Validates that products are still in inventory
            -->
            <task type="Merchello.Web.Validation.Tasks.ValidateProductInventoryTask, Merchello.Web" />
        </tasks>
      </taskChain>
    

    The basket code itself (other than adding a few more methods) has not changed much - I'm pretty sure this is the issue your fighting.

  • Flavio Spezi 128 posts 314 karma points
    Aug 26, 2016 @ 09:33
    Flavio Spezi
    0

    Thank you @Rusty.

    It solve my issue.

    Thanks!

Please Sign in or register to post replies

Write your reply to:

Draft