Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Mini-cart (or other functionality) on a non-xcart page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 06-08-2005, 02:59 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

Here's code I used previously for a login box:

Code:
<? #===========================================================================================# # # # X-CART LOGIN INTEGRATION - Jon Peters # # WEBSITECM.COM # # This script allows you to put a login/logout box on your non-xcart pages # # The $login variable can be used to pull further information from the database # # # # Created July 16, 2004 # # # #===========================================================================================# # # # USAGE: # # # # Save this code as loginscript.php and upload to your server # # Include the file on your php pages (using a php include) where you want the box to appear # # # #===========================================================================================# #--------------------------------------------- # REQUIRE X-CART INFORMATION #--------------------------------------------- require_once "/full/path/to/your/file/auth.php"; $query = "SELECT firstname,lastname FROM $sql_tbl[customers] WHERE login='" . strip_tags(addslashes($login)) . "'"; $login_name = func_query_first($query); #--------------------------------------------- # SHOW LOG IN #--------------------------------------------- if (!$login) { ?> <table width="215" border="0" cellpadding="2" cellspacing="0"> <tr> <td width="105" align="right"> <FORM action="http://www.YOURSITEHERE.com/xcart/include/login.php" method=post name=authform> <input type=hidden name=mode value=login> <input type=hidden name=usertype value="C"> <input type=hidden name=redirect value="customer"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="30%" align="right"><span class="style5">Username:</span></td> <td width="70%" align="right"><input type="text" name="username" TABINDEX="1" style="font-family: tahoma; font-size: 11px; width: 125; height: 20; border-color: #303030; border-width: 1px; padding-left: 4px; padding-right: 0px; padding-top: 2px; padding-bottom: 0px" size="20"></td> </tr> </table> </td> <td rowspan="2"><input type="image" src="/images/layout/login_sideways.gif" value="Submit" width="20" height="46" TABINDEX="3"></td> </tr> <tr> <td valign="top" align="right"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="right"><span class="style6">Password:</span></td> <td align="right"><input type="text" name="password" TABINDEX="2" style="font-family: tahoma; font-size: 11px; width: 125; height: 20; border-color: #303030; border-width: 1px; padding-left: 4px; padding-right: 0px; padding-top: 2px; padding-bottom: 0px" size="20"></td> </tr> </table> </td> </form> </tr> </table> <? #--------------------------------------------- # SHOW LOG OUT #--------------------------------------------- } else { ?> <table border="0" cellpadding="5" cellspacing="0" width="215"> <tr> <td colspan="2"> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <form action="http://www.YOURSITEHERE.com/xcart/include/login.php" method=post name=loginform> <tr> <td valign="top"> <font color="#FFFFFF">You're logged in as: <? echo ucfirst($login_name[firstname]) . " " . ucfirst($login_name[lastname]); ?></font> <font color="#C0C0C0">View Cart</font> | <font color="#C0C0C0">Modify Profile</font> | <font color="#C0C0C0">Logoff</font> </td> </tr> <input type="hidden" name="mode" value="logout"><input type="hidden" name="redirect" value="customer"> </form> </table> </table> <? } ?>
Reply With Quote
  #12  
Old 06-09-2005, 05:56 AM
 
grnyj93 grnyj93 is offline
 

Advanced Member
  
Join Date: Nov 2004
Location: US
Posts: 38
 

Default

Jon,

Thanks a ton for your help and sorry about the confusion.

I guess I am not that familar with the php shorthand.

Thanks again for all the help figuring this out - I owe you.
__________________
x-cart 4.0.13
Reply With Quote
  #13  
Old 06-25-2006, 08:52 PM
 
yages yages is offline
 

eXpert
  
Join Date: Sep 2004
Location: Australia
Posts: 332
 

Default

Can this script be used as a stand along login page.

I am receiving spam bots which are causing hundreds of error logins and I wish to delete the login box from all x-cart pages.

If I add a login link from all x-cart pages directing the customers to a stand along login page, I hope this will eliminate the spam I am getting

Will this script solve my problems
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #14  
Old 06-25-2006, 09:23 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

It could be apdapted to be used for that purpose yes, or you could just create an embedded x-cart page with the login html code.
Reply With Quote
  #15  
Old 06-25-2006, 11:42 PM
 
yages yages is offline
 

eXpert
  
Join Date: Sep 2004
Location: Australia
Posts: 332
 

Default

Created a HTML login page, works great.
Now how do I delete the login from the x-cart pages
What template do I edit
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #16  
Old 06-26-2006, 12:40 PM
 
yages yages is offline
 

eXpert
  
Join Date: Sep 2004
Location: Australia
Posts: 332
 

Default

One problem with the html login page
The customer can not logout or modify their profile
How can this be overcome
__________________
yages
x-cart version 4.5.5
Reply With Quote
  #17  
Old 07-06-2006, 10:21 AM
 
teddychan teddychan is offline
 

Member
  
Join Date: Mar 2006
Posts: 25
 

Default mini cart with Last added item's image

hi,
i have modified the mini cart but i want to show the LAST ADDED item gallery image.

is it possible?

i want to set the width to fixed "100px"

I am using x-cart 4.1.2, work well for 4.1.x now (without image~~)

here is my code:

Code:
{* $Id: minicart.tpl,v 1.17 2006/03/28 08:21:07 max Exp $ *} <table cellpadding="1" cellspacing="0"> {if $minicart_total_items > 0} <tr> <td class="VertMenuItems" colspan="3"> <table cellpadding="1" cellspacing="0" border="0" width="100%"> <!-- Product Name {$minicart_contents[num].product} Product Id {$minicart_contents[num].productid} The link so customers can delete items from minicart <a href=cart.php?mode=delete&productindex={$minicart_contents[num].cartid}></a> the link to product id: product.php?productid={$minicart_contents[num].productid} Product Options {$minicart_contents[num].product_options} Product Quantity {$minicart_contents[num].amount} Cart Total {include file="currency.tpl" value=$minicart_total_cost} --> {section name=num loop=$minicart_contents} <tr> <td class="MiniCartTextTiny" nowrap="nowrap">{$minicart_contents[num].amount} X </td> <td class="MiniCartTextTiny" nowrap="nowrap">{$minicart_contents[num].product|truncate:13:"...":true}</td> <td class="MiniCartTextTiny" nowrap="nowrap" align="right">{$minicart_contents[num].display_subtotal}</td> </tr> {/section} </table> <hr class="VertMenuHr" size="1" /> {* include file="product_thumbnail.tpl" productid=$minicart_contents[just_add_product].productid image_x="130" product=$minicart_contents[just_add_product].product tmbn_url=$minicart_contents[just_add_product].tmbn_url *} </td> </tr> <tr> <td rowspan="2" width="23">[img]{$ImagesDir}/cart_full.gif[/img]</td> <td class="VertMenuItems">{$lng.lbl_cart_items}: </td> <td class="VertMenuItems">{$minicart_total_items}</td> </tr> <tr> <td class="VertMenuItems">{$lng.lbl_total}: </td> <td class="VertMenuItems">{include file="currency.tpl" value=$minicart_total_cost} </td> </tr> {else} <tr> <td rowspan="2" width="23">[img]{$ImagesDir}/cart_empty.gif[/img]</td> <td class="VertMenuItems" align="center">{$lng.lbl_cart_is_empty}</td> </tr> <tr> <td class="VertMenuItems"></td> </tr> {/if} </table> <hr class="VertMenuHr" size="1" />{* $Id: minicart.tpl,v 1.17 2006/03/28 08:21:07 max Exp $ *} <table cellpadding="1" cellspacing="0"> {if $minicart_total_items > 0} <tr> <td class="VertMenuItems" colspan="3"> <table cellpadding="1" cellspacing="0" border="0" width="100%"> <!-- Product Name {$minicart_contents[num].product} Product Id {$minicart_contents[num].productid} The link so customers can delete items from minicart <a href=cart.php?mode=delete&productindex={$minicart_contents[num].cartid}></a> the link to product id: product.php?productid={$minicart_contents[num].productid} Product Options {$minicart_contents[num].product_options} Product Quantity {$minicart_contents[num].amount} Cart Total {include file="currency.tpl" value=$minicart_total_cost} --> {section name=num loop=$minicart_contents} <tr> <td class="MiniCartTextTiny" nowrap="nowrap">{$minicart_contents[num].amount} X </td> <td class="MiniCartTextTiny" nowrap="nowrap">{$minicart_contents[num].product|truncate:13:"...":true}</td> <td class="MiniCartTextTiny" nowrap="nowrap" align="right">{$minicart_contents[num].display_subtotal}</td> </tr> {/section} </table> <hr class="VertMenuHr" size="1" /> {* include file="product_thumbnail.tpl" productid=$minicart_contents[just_add_product].productid image_x="130" product=$minicart_contents[just_add_product].product tmbn_url=$minicart_contents[just_add_product].tmbn_url *} </td> </tr> <tr> <td rowspan="2" width="23">[img]{$ImagesDir}/cart_full.gif[/img]</td> <td class="VertMenuItems">{$lng.lbl_cart_items}: </td> <td class="VertMenuItems">{$minicart_total_items}</td> </tr> <tr> <td class="VertMenuItems">{$lng.lbl_total}: </td> <td class="VertMenuItems">{include file="currency.tpl" value=$minicart_total_cost} </td> </tr> {else} <tr> <td rowspan="2" width="23">[img]{$ImagesDir}/cart_empty.gif[/img]</td> <td class="VertMenuItems" align="center">{$lng.lbl_cart_is_empty}</td> </tr> <tr> <td class="VertMenuItems"></td> </tr> {/if} </table> <hr class="VertMenuHr" size="1" />
__________________
--
Reply With Quote
  #18  
Old 12-28-2006, 11:26 AM
 
pcarcare pcarcare is offline
 

eXpert
  
Join Date: Jun 2004
Location: Salt Lake City, Utah
Posts: 230
 

Default Re: Mini-cart (or other functionality) on a non-xcart page

This is great. I have been looking for this for awhile now. I copied and pasted the code above into a php file. When I call the file directly and I get the following error..

Parse error: syntax error, unexpected '}' in /home/username/public_html/ext_menu_cart.php on line 52

Can't seem to figure out why?

I get the same error in and outside the xcart root. I am using this on version 4.0.18

Any ideas?
__________________
X-cart gold 4.5.2 (live)
X-payments 1.0.5

http://www.professionalcarcare.com
Your online source for all your car care needs
Reply With Quote
  #19  
Old 12-28-2006, 12:12 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Mini-cart (or other functionality) on a non-xcart page

Your server may not support php short tags, try changing <? to <?php

If that does not work, make sure the code copy and pasted correctly.
Reply With Quote
  #20  
Old 12-28-2006, 01:56 PM
 
pcarcare pcarcare is offline
 

eXpert
  
Join Date: Jun 2004
Location: Salt Lake City, Utah
Posts: 230
 

Default Re: Mini-cart (or other functionality) on a non-xcart page

I already changed <? to <php?. With <? I get the following error....

"ERROR: Can not initiate application! Please check configuration."

I re-copied the code, and I am still getting the same error....

"Parse error: syntax error, unexpected '}' in /home/myusername/public_html/ext_menu_cart.php on line 52"

If I remove

{

} else {
echo "Your shopping cart is currently empty.";
}

The script shows up.

Any other ideas?
__________________
X-cart gold 4.5.2 (live)
X-payments 1.0.5

http://www.professionalcarcare.com
Your online source for all your car care needs
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:39 PM.

   

 
X-Cart forums © 2001-2020