Author Topic: (solved)Add a link for returning to shop in the empty cart page.  (Read 13648 times)

pitalala

  • Beginner
  • *
  • Posts: 7
 ??? Hi There,

When customer deletes all the items in cart, the page will show "your cart is currently empty" , how can i add a link here so that customers can click to go back to the shop. pls assist...
Files too Large for Emails?

Share your Files! http://www.upload.sg
Host files, images, videos, audio and flash. And its Free!

revive

  • Jr. Member
  • **
  • Posts: 96
Re: Add a link for returning to shop in the empty cart page.
« Reply #1 on: January 28, 2009, 12:14:33 pm »
ok.. here's an answer for you.. I've been searching EVERYWHERE for this and finally figured it out.. at least how to add to the page to add something for users to click and go to the sites products page.

go to: /components/com_virtuemart/themes/default/templates/pages/shop.cart.tpl.php

On or about line 21 you'll see this code:
Code: [Select]
<!-- Cart Begins here -->
';
include(PAGEPATH. 'basket.php');
echo $basket_html;
echo '<!-- End Cart --><br />
';

I changed ours to look like this, adding an image as you can see - so make sure you either have the image or change the url to one you do have:
Also note, the link in this code directs them to 'products' which is the page of our vm installation.. change this to whatever your link is.
Code: [Select]
<!-- Cart Begins here -->
';
include(PAGEPATH. 'basket.php');
echo $basket_html;
if ($cart["idx"] == 0) {
echo '<!-- End Cart --> <br /><br />
<a href="products"><img src="components/com_virtuemart/themes/default/images/back.png" style="vertical-align:text-bottom;">
<span style="font-weight:bold; font-size:18px;">Continue Shopping</span></a>
';
}

If you want to remove the words; "Your cart is currently empty" just remove this:

echo $basket_html;

I you run into any questions let me know, I'll do what I can to help.
;)

J

pitalala

  • Beginner
  • *
  • Posts: 7
Re: Add a link for returning to shop in the empty cart page.
« Reply #2 on: January 29, 2009, 06:14:13 am »
That worked perfectly :) Thanks revive :)
Files too Large for Emails?

Share your Files! http://www.upload.sg
Host files, images, videos, audio and flash. And its Free!

revive

  • Jr. Member
  • **
  • Posts: 96
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #3 on: January 30, 2009, 15:15:29 pm »
;) anytime

klutzon

  • Jr. Member
  • **
  • Posts: 319
  • Knuckles the Echidna
    • Rage3D
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #4 on: January 31, 2009, 15:52:50 pm »
Thanks for the tip revive! :)

revive

  • Jr. Member
  • **
  • Posts: 96
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #5 on: February 17, 2009, 14:47:18 pm »
Anytime ;)

belindab

  • Jr. Member
  • **
  • Posts: 103
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #6 on: February 17, 2009, 23:51:19 pm »
revive, you got me started here, ;D but I needed a multilingual solution so I couldn't hard code the text and needed to use variables so that this will work with Joomfish.

I also wanted to have the Continue Shopping link to appear whenever you go to the Cart, even if empty in the first place.

If continue_link isn't set already, this takes you to the catalogue page, but you could change '?option=com_virtuemart' to wherever....

So this is my mod:

Code: [Select]
include(PAGEPATH. 'basket.php');
echo $basket_html;
echo '<!-- End Cart --><br /> <br />';
// hack to get the Continue Shopping link even if the cart is empty
if ($cart["idx"] == 0) {
    ?>
    <div align="center">
    <?php
    
if( $continue_link != '') {
       
?>

       <a href="<?php echo $continue_link ?>" class="continue_link">
       <?php echo $VM_LANG->_('PHPSHOP_CONTINUE_SHOPPING'); ?>
       </a>
       <?php
    
}
    else  { 
          $continue_link=$sess->url($_SERVER['PHP_SELF'].'?option=com_virtuemart' ); 
    
?>

    <a href="<?php echo $continue_link ?>" class="continue_link">
    <?php echo $VM_LANG->_('PHPSHOP_CONTINUE_SHOPPING'); ?>
    </a>
    <?php
    
}
}
// end of hack

Hope this makes someones day, like you did mine!  ;)

revive

  • Jr. Member
  • **
  • Posts: 96
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #7 on: February 18, 2009, 04:39:21 am »
That's awesome! Glad this got you started and thanks for sharing your improvements to the code!
Keep up the great work,
Cheers

JJRO

  • Jr. Member
  • **
  • Posts: 62
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #8 on: March 26, 2009, 17:59:23 pm »
Great work guys!
I'm getting the <<CONTINUE SHOPPING now on the empty cart (I'm using <a href="javascript:history.go(-1)" class="continue_link"> and returning shoppers to the previous page),
but when there's anything in the cart I still only get the CHECKOUT>> option.

quantum_leap

  • Beginner
  • *
  • Posts: 10
    • My CV
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #9 on: May 31, 2009, 16:42:43 pm »
I am no expert in PHP at all but I made two modifications in the code and now it works for me. I removed the last "}" from the code, I have also changed if ($cart["idx"] == 0) to if ($cart["idx"] >= 0)

Code: [Select]
include(PAGEPATH. 'basket.php');
echo $basket_html;
echo '<!-- End Cart --><br />
';

if ($cart["idx"] >= 0) {
    ?><br /><br />
    <div align="center">
    <?php
    
if( $continue_link != '') {
?>

<a href="<?php echo $continue_link ?>" class="continue_link">
<?php echo $VM_LANG->_('PHPSHOP_CONTINUE_SHOPPING'); ?>
</a>
<?php
    
}
else  
{$continue_link=$sess->url($_SERVER['PHP_SELF'].'?page=shop.browse&amp;category_id='.$category_id );
    
?>

<a href="<?php echo $continue_link ?>" class="continue_link">
    <?php echo $VM_LANG->_('PHPSHOP_CONTINUE_SHOPPING'); ?>
</a>
<?php
    
}
Joomla! 1.5.15, VirtueMart 1.1.4 stable

Atta_Girl

  • Beginner
  • *
  • Posts: 14
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #10 on: June 01, 2009, 17:37:06 pm »
Thanks to everyone... This post was very helpful!

foofer00

  • Beginner
  • *
  • Posts: 1
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #11 on: July 09, 2009, 00:30:23 am »
need help, i am fairly new to virtue mart and currently using Joomla,

when adding a product to my shopping cart everything works fine and I have the 2 buttons "continue shopping" and "proceed to checkout"

when I empty the shopping cart to zero the cart say "Your Cart is currently empty." I would like to direct the customers back to the home page or to the products page, but again I am fairly new... I am able to go into the theme "pbv_shopper" that i am currently using and change and edit the code in "shop.cart.tpl" I was not able to understand what to edit when replacing the current code with the new one you made...


Annaica

  • Beginner
  • *
  • Posts: 42
Re: (solved)Add a link for returning to shop in the empty cart page.
« Reply #12 on: September 24, 2009, 14:50:38 pm »
Thank you for this. Works like a charm!