php code problem in custom template

General ShopSite user discussion

php code problem in custom template

Postby priscila » Sat Jan 05, 2008 10:02 pm

I want add php code in header & footer in my shopping cart custom template. I used the following code for including those header & footer ( both are php files ).

<tr>
<td>
[-- ShoppingCartHeader --]
[-- INCLUDE ss_header.php --]
</td>
</tr>
.
..
...
<tr>
<td>
[-- ShoppingCartFooter --]
[-- INCLUDE ss_footer.php --]
</td>
</tr>

Suppose , those php files have :
<?php
$menu="test";
echo $menu;
?>


But the problem is, the output is :
<?php
$menu="test";
echo $menu;
?>

with php tags , not the value test.

Is there any solution? Can't I use php code in my custom template ?
priscila
 
Posts: 29
Joined: Mon Oct 22, 2007 10:59 pm

Postby Jim » Sat Jan 05, 2008 10:49 pm

I don't know anything about php but there have been a number of posts to the forum showing how to use php in ShopSite. Do a search (top center of screen under ShopSite Forums title) for php and you will find a number of hits. Here is one that has some php code that supposedly works http://support.shopsite.com/forums/view ... hlight=php
Jim
Site Admin
 
Posts: 4953
Joined: Fri Aug 04, 2006 1:42 pm
Location: Utah

Postby JeremeD » Sun Jan 06, 2008 10:09 pm

Priscilla,

It's not working because the cart runs on CGI. It may be possible to use PHP in CGI files but you would have to contact your host and ask them if they would make the necessary configuration changes for you. It's best just to assume that you cannot use PHP code in the cart.

What are you trying to do exactly? If you're just trying to include a menu as in your example, the ShopSite includes would be more than sufficient for that. http://shopsite.com/help/9.0/en-US/sc/p ... clude.html
SD360.com
Certified ShopSite Designer
ShopSite Templates Available Now
JeremeD
 
Posts: 60
Joined: Sat Feb 10, 2007 4:20 pm
Location: Athens, GA

Postby priscila » Mon Jan 07, 2008 10:21 pm

I am using 1 store both for wholesale & retail customer. All products are duplicate except their price for that. I want to use different header - footer for wholesale & retail customer. Problem is as I can't use 2 shopping cart custom template at a time , so how can I change the header-footer & show 2 different header-footer for wholesale & retail customer ?
priscila
 
Posts: 29
Joined: Mon Oct 22, 2007 10:59 pm

Postby JeremeD » Tue Jan 08, 2008 9:59 pm

I cannot think of a way to show two distinct headers on the cart screens. If I come up with something I'll post back here. Maybe someone else will have an idea for you.
SD360.com
Certified ShopSite Designer
ShopSite Templates Available Now
JeremeD
 
Posts: 60
Joined: Sat Feb 10, 2007 4:20 pm
Location: Athens, GA

Postby loren_d_c » Wed Jan 09, 2008 11:39 am

How would your PHP code determine what header/footer to display? I would assume by reading a cookie placed in the shopper's browser that indicates whether they are 'wholesale' or 'retail' shoppers. If this is the case, then perhaps you could use JavaScript instead, because you can also read/set cookies via JavaScript.

-Loren
loren_d_c
 
Posts: 2572
Joined: Fri Aug 04, 2006 12:02 pm
Location: Anywhere

Re: php code problem in custom template

Postby mokele » Thu Jan 24, 2008 4:54 pm

Since Shopping Cart is a CGI program you can't use PHP directly within the Shopping Cart template, but you could possibly use a CALL tag that could import a different header and footer. You'd have to pass a variable to select which header or footer you wanted. The program you call can be Perl or PHP. With PHP, the PHP Command Line Interface (CLI) must be installed on the server. I've used PHP as a CALL program to output HTML but have not used it to try switching headers and footers. So something like
Code: Select all
[-- CALL getHeader.php("Wholesale") --]

then the PHP program would give you the wholesale header.

You might be able to use the VAR variable with the Includes in custom templates, not sure if would work you'd just have to try, but it would look something like this:
Code: Select all
[-- VAR.ClientType "Wholesale" --]

[-- IF  VAR.ClientType "Wholesale" --]
[-- INCLUDE ss_header_wholesale --]
[-- END IF --]

[-- IF  VAR.ClientType "Retail" --]
[-- INCLUDE ss_header_retail --]
[-- END IF --]
Scott Norman
Web Developer/Programmer
YourHost.com
Ecommerce Web Site Hosting & Internet Solutions
mokele
 
Posts: 20
Joined: Thu Aug 10, 2006 12:30 pm
Location: Fountian Valley, CA

Postby priscila » Mon Jan 28, 2008 2:19 am

I m using ShopSite's custom template for shopping cart & customer registration. Other pages of my site is simple php page. So, where should I include this code :
[-- CALL getHeader.php("Wholesale") --]

Plz make me clear.

-Priscila
priscila
 
Posts: 29
Joined: Mon Oct 22, 2007 10:59 pm


Return to User Forum

Who is online

Users browsing this forum: No registered users and 82 guests