Announcement

Collapse
No announcement yet.

Product and 'Add To Cart' in sidebar

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

    Product and 'Add To Cart' in sidebar

    I would like to be able to show a product or two with 'Add To Cart' buttons in the sidebar throughout the site.

    I Have added
    Code:
    <actinic:block type="ProductList">
    Compact product layout
    </actinic:block>
    And on a product page the product displays beautifully in the sidebar.
    http://www.graphicz.eu.com/site1/acatalog/Koala.html
    I have tried hard coding SectionID and SectionCatFile but the sidebar still displays the products of the page it is on.
    What is it that tells the product layout which product to display and can I hard code that for my sidebar product layout?
    There is some javascript in the header that seems to relate to products being shown:
    Code:
    <script language="javascript" type="text/javascript">
    function displayStock()
    {
    var sProdRefs = ""; 
    var sStockList = ""; 
    getSectionStock('http://www.graphicz.eu.com/cgi-bin/st000001.cgi', '21', sProdRefs, sStockList, '');	
    }
    AttachEvent(window, "load", displayStock);
    </script>
    Could this be adapted to apply to my sidebar product div so the same product appears throughout the site, brouchure and sections?

    Any thoughts would be extremely welcome.

    Thank you.
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    #2
    I would use some custom variables for this and then create an add-to-cart from anywhere on the internet from the AUG as the buy link.

    Comment


      #3
      Another way.

      Create a new Product level variable "ShowInSidebar" of type True / false, default false. Set it to be True on the product you wish to show.

      Use code in the sidebar like:
      Code:
      <actinic:block type="EntireSectionList">
      	<actinic:block type="ProductList">
      		<actinic:block if="%3cactinic%3avariable%20name%3d%22ShowInSidebar%22%20%2f%3e" >
      			Compact product layout
      		</actinic:block>	
      	</actinic:block>
      </actinic:block>
      Note that will mean a complete iteration therough the entire store when each page is being created and may slow down site generation if you have a huge site.
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Thank you Norman and Duncan

        I also found the solution courtesy of Tracey http://community.actinic.com/showthread.php?t=39958
        and Gabriel http://community.actinic.com/showthread.php?t=35126

        Similar to Norman's solution you can also put:
        <actinic:block type="EntireSectionList" >
        <actinic:block type="ProductList">
        <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionName%22%20%2f%3e%20%3d%3d%20%22YourSectionHere%22" >
        ProductLayout
        </actinic:block>
        </actinic:block>
        </actinic:block>
        For anyone else struggling here is my version of the complete code

        Code:
        <actinic:block type="EntireSectionList" >
        <actinic:block type="ProductList">
        <actinic:block if="%3cactinic%3avariable%20name%3d%22SectionName%22%20%2f%3e%20%3d%3d%20%22YourSectionName%22" >
        <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductFormUsed%22%20%2f%3e">
              <form method="post" action="<actinic:variable name="OnlineScriptURL" value="Shopping Cart Script URL" />"> 
                 <input type="hidden" name="SID" value="<Actinic:Variable Name="SectionID"/>" />
                 <input type="hidden" name="PAGE" value="PRODUCT" />           
                 <input type="hidden" name="PAGEFILENAME" value="<actinic:variable name="SectionPageName" />" />
                 <Actinic:SECTION BLOB='<Actinic:Variable Name="SectionCatFile"/>'/>
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22IsHostMode%22%20%2f%3e">
                    <!-- Hidden field when in trial mode -->
                    <input type="hidden" name="SHOP" value="<Actinic:Variable Name="HiddenFields"/>" />
                 </actinic:block>
        </actinic:block>
        
        	<div class="product_listjc">
        			<div>
                 <a name="<Actinic:Variable Name="EncodedProductAnchor"/>"></a>
        			<h2 style="margin:0;padding:0;"><Actinic:Variable Name="ProductName"/></h2>
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductReferenceVisible%22%20%2f%3e" >
                   Ref: <actinic:variable name="ProductReference" />
                 </actinic:block>
                 <br />
        <a href="<actinic:block if="%3cactinic%3avariable%20name%3d%22IsBrochureHomePage%22%20%2f%3e">acatalog/</actinic:block>
        <actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20AND%0d%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e" ><actinic:variable name="SectionPageName" /></actinic:block>
        <actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20%3d%3d%20false%29%20OR%0d%28%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e%20%3d%3d%20false%29" ><actinic:variable name="SectionURL" /></actinic:block>"><img src="<actinic:variable name="ProductImageFileName" />" alt="See more information about <actinic:variable name="ProductName" />" border="0" width="90" /></a><br />
        <a href="<actinic:block if="%3cactinic%3avariable%20name%3d%22IsBrochureHomePage%22%20%2f%3e">acatalog/</actinic:block>
        <actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20AND%0d%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e" ><actinic:variable name="SectionPageName" /></actinic:block>
        <actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20%3d%3d%20false%29%20OR%0d%28%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e%20%3d%3d%20false%29" ><actinic:variable name="SectionURL" /></actinic:block>">More Info</a><br />
                 <actinic:variable name="RealTimeStockDisplay" />
        
                 <div>
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22IsAddToCartButtonShown%22%20%2f%3e%20AND%20%0d%28%3cactinic%3avariable%20name%3d%22NumberAttributesInPushButtonGrid%22%20%2f%3e%20%3d%3d%200%29" >
                    <actinic:variable name="AddToCartButton" />
                 </actinic:block>
        			</div>
        
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22IsOutOfStockShown%22%20%2f%3e">
                    <div><strong><span class="actrequired"><Actinic:Variable Name="OutOfStock"/></span></strong></div>
                 </actinic:block>
        
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22IsCatalogSuspendedShown%22%20%2f%3e">
                    <div><strong><span class="actrequired"><Actinic:Variable Name="CatalogSuspended"/></span></strong></div>
                 </actinic:block>
        			
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22PriceIsEnabled%22%20%2f%3e">
        				<Actinic:PRICES PROD_REF="<actinic:variable Name="ProductID" />" RETAIL_PRICE_PROMPT="<Actinic:Variable Name="ProductPriceDescription"/>">
                    <actinic:variable name="PriceListRetail" />
                    </Actinic:PRICES>
                 </actinic:block>
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22ProductPriceIsEnabled%22%20%2f%3e%20%3d%3d%20False">
        	         <Actinic:NOTINB2B><br /><actinic:variable name="ProductPriceNotEnabledMessage" /></Actinic:NOTINB2B>
                 </actinic:block>
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22IsCustomerMessageUsed%22%20%2f%3e">
                    <br />
                    <Actinic:PRICE_EXPLANATION PROD_REF="<actinic:variable Name="ProductID" />" COMPONENTID=-1><Actinic:Variable Name="RetailCustomerMessage"/></Actinic:PRICE_EXPLANATION>
                 </actinic:block>
        			<actinic:block if="%3cactinic%3avariable%20name%3d%22IsQuantityPromptShown%22%20%2f%3e%20AND%20%28%3cactinic%3avariable%20name%3d%22IsOutOfStockShown%22%20%2f%3e%20%3d%3d%20FALSE%29%20AND%20%28%3cactinic%3avariable%20name%3d%22IsCatalogSuspendedShown%22%20%2f%3e%20%3d%3d%20FALSE%29" >  
        				<actinic:block if="%3cactinic%3avariable%20name%3d%22CartButtonVisibleToAllCustomers%22%20%2f%3e" >
        				<!-- This code is used when the quantity box is visible to all customers -->
        				<br />
        				<span class="actrequired"><Actinic:Variable Name="QuantityPrompt"/></span>
        				&nbsp;
        				<input type="text" name="Q_<actinic:variable Name="ProductID"/>" size="4" value="<Actinic:Variable Name="DefaultQuantity"/>" class="form_input_general" />
        				</actinic:block> 
        				<actinic:block if="%3cactinic%3avariable%20name%3d%22EnabledForCustomerGroupID%22%20%2f%3e%20%21%3d%20%22%22">
        					<actinic:block if="%3cactinic%3avariable%20name%3d%22ProductPriceIsEnabled%22%20%2f%3e" >
        					<!-- This code is used when the quantity box is visible to retail customers, but not all other customer groups -->
        				<Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />">
        					<br />
        					<span class="actrequired"><Actinic:Variable Name="QuantityPrompt"/></span>
        					&nbsp;
        					<input type="text" name="Q_<actinic:variable Name="ProductID"/>" size="4" value="<Actinic:Variable Name="DefaultQuantity"/>" class="form_input_general" />
        				</Actinic:ShowForPriceSchedule>
        					</actinic:block>
        					<actinic:block if="%3cactinic%3avariable%20name%3d%22ProductPriceIsEnabled%22%20%2f%3e%20%3d%3d%20FALSE" >		
        					<!-- This code is used when the quantity box needs to hidden from retail customers -->
        					<Actinic:ShowForPriceSchedule Schedules="<actinic:variable name="EnabledForCustomerGroupID" />" HTML="<br /><span class='actrequired'><Actinic:Variable Name="QuantityPrompt"/></span>&nbsp;<input type='text' name='Q_<actinic:variable Name="ProductID"/>' size='4' value='<Actinic:Variable Name="DefaultQuantity"/>'  class="form_input_general" />"></Actinic:ShowForPriceSchedule>
        					</actinic:block>
        				</actinic:block> 
        			</actinic:block>
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22IsQuantityPromptHidden%22%20%2f%3e">
                    <input type="hidden" name="Q_<actinic:variable Name="ProductID"/>"  value="<actinic:variable name="DefaultQuantity"/>" />
                 </actinic:block>
                 </p>
                 <actinic:variable name="AttributeList" />
                 <actinic:variable name="ComponentList" />
              </div>  
        			<actinic:variable name="CartError" />         
        			<actinic:variable name="ProductDescription" /> 
        
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22FileURLNotEmpty%22%20%2f%3e">
                    <br />
                    <a href="<Actinic:Variable Name="ProductLinkInfo"/>">
                       <Actinic:Variable Name="ProductLinkText"/>
                    </a>
                 </actinic:block>
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22DiscountDescriptionIsShownForProducts%22%20%2f%3e">      
                    <actinic:variable name="DiscountList" value="Standard Discount List" />
                 </actinic:block>
                 
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22IsOtherInfoPromptShown%22%20%2f%3e">
                    <br />
                    <span class="actrequired"><Actinic:Variable Name="OtherInfoPrompt"/></span><br />
                    <input type="text" name="O_<Actinic:Variable Name="ProductID"/>" size="40" maxlength="1000" value="" />
                 </actinic:block>
                 
                 <actinic:block if="%3cactinic%3avariable%20name%3d%22IsDatePromptShown%22%20%2f%3e">
                    <br />
                    <span class="actrequired"><actinic:variable name="DatePrompt"/></span><br />
                    <actinic:variable name="DayList" /><actinic:variable name="MonthList" /><actinic:variable name="YearList" />
                 </actinic:block>
                 
                 <actinic:variable name="ProductAlsoBoughtList" />
                 
                 <actinic:variable name="ProductRelatedProductsList" />
        
                 <actinic:variable name="FeefoProductLogo" />
        
                 <actinic:variable name="FeefoProductFeedback" />
        
        	</div>
        
        <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductFormUsed%22%20%2f%3e">
              </form>
        </actinic:block>
        </actinic:block>
        </actinic:block>
        </actinic:block>
        Norman's version is much more usable and flexible.

        Thank you everyone very much.
        Jonathan Chappell
        Website Designer
        SellerDeck Website Designer
        Actinic to SellerDeck upgrades
        Graphicz Limited - www.graphicz.co.uk

        Comment


          #5
          One hitch! The add to cart button works fine on the brochure pages that are within the acatalog folder but the add to cart button in the sidebar of the home page yields this error:
          Error: The requested file (acatalog/Tulips.html) is outside the scope of the script.
          Any ideas?
          Thanks
          Jonathan Chappell
          Website Designer
          SellerDeck Website Designer
          Actinic to SellerDeck upgrades
          Graphicz Limited - www.graphicz.co.uk

          Comment


            #6
            The issue is solved at: http://community.actinic.com/showthread.php?t=35370

            Change
            Code:
            <input type="hidden" name="PAGEFILENAME" value="<actinic:variable name="SectionPageName" />" />
            To:
            For mini best sellers list etc on the home page only:
            Code:
            <input type="hidden" name="<actinic:variable name="CatalogURL" /><actinic:variable name="SectionPageName" encoding="perl" selectable="false" />" />
            For the side bar product site wide:
            Code:
            <actinic:block if="%3cactinic%3avariable%20name%3d%22IsBrochureHomePage%22%20%2f%3e%20%3d%3d%20false">
            	      <input type="hidden" name="PAGEFILENAME" value="<actinic:variable name="SectionPageName" />" />   
                     </actinic:block>
                     <actinic:block if="%3cactinic%3avariable%20name%3d%22IsBrochureHomePage%22%20%2f%3e">
            	      <input type="hidden" name="<actinic:variable name="CatalogURL" /><actinic:variable name="SectionPageName" />" />   
                     </actinic:block>
            Credit Norman and Lee
            Jonathan Chappell
            Website Designer
            SellerDeck Website Designer
            Actinic to SellerDeck upgrades
            Graphicz Limited - www.graphicz.co.uk

            Comment

            Working...
            X