Passing a URL Variable to Cart page, using PHP IF/ELSE

General ShopSite user discussion

Passing a URL Variable to Cart page, using PHP IF/ELSE

Postby bluemarblebrands » Thu Mar 13, 2008 1:06 pm

I am inquiring as how to find a solution to having one shopping cart on one domain look exactly like any of two dozen other domains that list products.

The code consists of <DIV> tags to attach CSS rules to and IF/ELSE statements based on URL Variables (PHP) or Querystrings (ASP) to determine an include file.

Some example code from the top_nav section (in ASP):

Code: Select all
      <div id="top_nav">
            <% If Request.QueryString("BRAND")="MEDOG" Then %>
                  <!--#include file="SSI/MEDOG/top_nav.html" -->
            <% ElseIf Request.QueryString("BRAND")="COOL" %>   
                    <!--#include file="SSI/COOL/top_nav.html"-->
              <% Else %>
                  <!--#include file="SSI/DEFAULT/top_nav.html"-->
            <% End If %>
      </div><!-- END TOP_NAV-->


IN PHP:

Code: Select all
     <div id="top_nav">
      <?php
      $url_var = $_GET[BRAND'];
            if ($url_var=="MEDOG")
                  include("SSI/MEDOG/top_nav.html");
            elseif ($url_var=="COOL")
                  include("SSI/COOL/top_nav.html");
            Else
                  include("SSI/DEFAULT/top_nav.html");
      ?>
      </div><!-- END TOP_NAV-->

 


With the URL: http://www.URL.com/template.aspx?BRAND=COOL the /SSI/COOL/top_nav.html file would be loaded.

Does anyone have any experience in this matter?
Or has anyone found a solution to a similar problem?
Will this cause any errors with shopsite?
bluemarblebrands
 
Posts: 3
Joined: Thu Mar 13, 2008 12:50 pm

Postby Jim » Thu Mar 13, 2008 2:12 pm

You cannot pass additional parameters to the shopping cart cgis. Also PHP will only work on html pages it will not work on cgi pages.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby bluemarblebrands » Thu Mar 13, 2008 7:22 pm

what if the same information was grabbed from a cookie on the customer's computer?
bluemarblebrands
 
Posts: 3
Joined: Thu Mar 13, 2008 12:50 pm

Postby Jim » Thu Mar 13, 2008 7:40 pm

That might work but there is no requirements that cookies be enabled to place an order in ShopSite.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby bluemarblebrands » Fri Mar 14, 2008 10:41 am

What about calling the prevlocation variabel into IF/Else statements to edetermine what content gets loaded?
Code: Select all
IF
[-- IF prevlocation {http://www.site#1.com} --]
  Site#1 based HTML, text, and custom template tags
[-- ELSE_IF prevlocation {http://www.site#2.com} --]
  Site#2 based HTML, text, and custom template tags
[-- ELSE --]
  Default HTML, text, and custom template tags
[-- END_IF --]
bluemarblebrands
 
Posts: 3
Joined: Thu Mar 13, 2008 12:50 pm

Postby Jim » Fri Mar 14, 2008 11:53 am

This is not a ShopSite template tag
[-- IF prevlocation {http://www.site#1.com} --]
So that wouldn't work.
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah


Return to User Forum

Who is online

Users browsing this forum: No registered users and 84 guests