Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 2 of 2

Thread: Have an unpublished product appear in the shopping cart?

  1. #1
    akeller is offline Member
    Join Date
    Dec 2008
    Posts
    78

    Default Have an unpublished product appear in the shopping cart?

    I have implemented a way to use Storefront's coupon code but instead of applying a discount I add a free gift item. I searched all over for a solution or plug-in but just decided to code the thing myself. Which is best because I am able to retain the same logic and validation.

    So basically everything works fantastic except for one small issue. The free gift items are actual products we have created in Storefront. Obviously we don't want a customer to stumble upon this item when browsing the site because we would like them to enter the coupon codes. If the product is unpublished, it cannot be added to the shopping cart. But if it is published it can be found in the search form. Are there any flags or settings that will allow a product to not be search-able or shown anywhere on the site but still be added to the cart?

    If not I already know what my alternatives are.
    - exclude those free gift ProductID's in search (or)
    - create a new column in the product table to indicate if its search-able/hidden and write some logic.

    Any ideas would be appreciated

  2. #2
    ASPAlfred is offline Senior Member
    Join Date
    Nov 2007
    Posts
    2,244

    Default

    Your alternative solution should work fine, but I'm wondering if you'd like to try this suggestion as well.

    Follow these steps:

    1. Run an update statement against the product table and set ShowInProductBrowser to 0 (e.g. UPDATE PRODUCT SET ShowInProductBrowser = 0 WHERE PRODUCTID='TheProductIDToUpdate')
    2. Open the aspdnsf_getproducts stored proc and modify:
    Code:
    WHERE pf.rownum >= @pagesize*(@pagenum-1)+1 and pf.rownum <= @pagesize*(@pagenum) ORDER BY pv.rownum
    to...

    Code:
    WHERE pf.rownum >= @pagesize*(@pagenum-1)+1 and pf.rownum <= @pagesize*(@pagenum) and showinproductbrowser = 1 ORDER BY pv.rownum
    ** the showinproductbrowser is unsupported field so you have to thoroughly test it after you've made this change. As always, please make a full backup first before changing anything.