Announcement

Collapse
No announcement yet.

Add to Cart from anywhere - How to get the SID ?

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

    Add to Cart from anywhere - How to get the SID ?

    Have been reading the AUG about the possibility of links from anywhere that will Add to Cart. This works fine, but you need to know the SID to build the link.

    So I wanted to enhance the "other items you might be interested in.." links on the Checkout to allow a single one-click add to cart (rather that viewing the product) to make it more impulse-buy.

    But of course I cannot build the link because this method requires the SID to be known.

    So how can I programmatically get the SID (so I can build the link in the sellerdeck template design) rather than hard-coding links.

    Any ideas code guru's ?

    Jez

    #2
    Shopping Cart and Checkout pages are not generated a site build time. They are dynamically created from the cart contents using Perl on the server. The layouts that are used for these pages contain place-markers for content that are filled in by the Perl code when the Cart / Checkout pages are displayed.

    So you'd probably need to patch the Perl that returns the "Other Items..." type links. Note that there is a useful routine LookUpSectionID in ACTINIC.pm that will look up the section ID for a given product reference.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Yes it is as I thought. Looks like it may be possible. Not too sure how to proceed, looks a bit complicated.

      Comment


        #4
        Here is a Perl tweak that will let you get the SID onto the Related Products and Also Bought lines in the Cart.
        Edit ActinicOrder.pm (back it up first) and look for:
        Code:
        sub AlsoBoughtItemLine
        A bit further you'll see a line starting with
        Code:
        $hVariables{$::VARPREFIX . 'THUMBNAIL'}
        Immediately after that line add:
        Code:
            my $sSID;
            ($Status, $sSID) = ACTINIC::LookUpSectionID(ACTINIC::GetPath(), $sProdref);    # look it up
            if ($Status == $::FAILURE)
                {
                return ($Status, 'No SID found', undef);
                }
            $hVariables{$::VARPREFIX . 'SID'}     = $sSID;
        Now in layouts Related Products in Shopping Cart and Also Bought Items in Shopping Cart you can display the SID via:
        Code:
        NETQUOTEVAR:SID
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Very good that worked perfectly. Many thanks. On another note, whilst you're in the area, do you have any thoughts on the troublesome "thumbnail" image that "related in the cart" uses? I have seen this question asked a million times but never really seen a solution. It seems it uses the "thumbnail" field from the product, but most people - me included - would like to change it so it uses a the main product image, sized to suit. We do not maintain the "thumbnail" field as there seems no need to do so, except for this. I notice the actual Cart thumbs use the product images, so why not the "related" and "also bought" ? Do you have a solution for this up your sleeve ?

          Comment


            #6
            Here is a Perl tweak that will use the Product Image if the Thumbnail isn't defined in Related Products and Also Bought lines in the Cart.
            Edit ActinicOrder.pm (back it up first) and look for:
            Code:
            sub AlsoBoughtItemLine
            A bit further you'll see a line:
            Code:
                my $sThumbnail = $$pProduct{'THUMBNAIL'};
            Rep[lace that line with:
            Code:
                my $sThumbnail = $$pProduct{'THUMBNAIL'} ? $$pProduct{'THUMBNAIL'} : $$pProduct{'IMAGE'};
            I've no idea why SD doesn't use this as standard. They use it elsewhere for the normal Related Products, etc..
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Excellent - that works as well. Many thanks Norman!

              Comment

              Working...
              X