Change Screen After Cart Is Emptied

  • Posts: 25
  • Thank you received: 0
12 years 3 weeks ago #71693

Good Day,

After i delete the last item in my shopping cart, the screen changes and a message at the top reads 'The cart is empty' and all my products with their corresponding prices are displayed in the main area of the window.

How can I just have the message 'The cart is empty' being displayed without the products and their prices showing at the bottom.
(It would be OK if the area where the products with their prices remains blank or as white space)

thank you in advance

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 3 weeks ago #71864

Hi,

You can change the page where the customer is redirected when his cart is empty in HikaShop > Configuration > Checkout, the option "URL where to redirect when the cart is empty"

Please Log in or Create an account to join the conversation.

  • Posts: 25
  • Thank you received: 0
12 years 2 weeks ago #72503

Hi again,

I do not necessarily need to change the page the user is redirected to.

Currently when the cart is cleared the URL which users are directed to is "MYSITE/index.php/component/hikashop/product/listing"

I would like to know which file or files I would need to modify in order to change how this page is displayed.
For instance, I would like the 'The cart is empty' message to continue to appear at the top. However I would like to remove all the code which causes the products to appear at this window and replace it with some of my very own code.

How can I do this?

Thank you again.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 2 weeks ago #72635

Hi,

To edit this view, you can edit the file "product / listing_img_title" or another listing depending on which one is used.
You have to go in HikaShop > Display > Views.

To have a different view only when the cart is empty, you can add a parameter in the url when the cart is cleared, for example: "MYSITE/index.php/component/hikashop/product/listing/cart-empty"
and then in the view file add controls to display your text, like: "if(JRequest::getString('cart','default')=='empty'{echo "Your text";}"

Please Log in or Create an account to join the conversation.

  • Posts: 25
  • Thank you received: 0
12 years 2 weeks ago #72667

Hi again,

I have cleared out the product/listing_img_title file so it is no longer displaying the items I have available.
However there is some other module I believe which is still running on this bottom of this page. Even though my products are not being displayed I can see the words "Display # 20" and "Results 1 - 3 of 3" at the bottom. I would like these words removed from the page. How can I do this?
Also if I do a simple echo "Hello World"; in the product/listing_img_title file "Hello World" is being displayed three times to reflect the number of products I have created. I would like this to stop.
How can I make it stop appearing this way.

PS:- I am not an expert programmer so please explain as thoroughly as possible.

thank you again

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 2 weeks ago #72911

Hi,

Before of :
echo "Hello World";

you can add:

static $alreadyDone = false;
if($alreadyDone) return;
$alreadyDone = true;

That way, it will do the echo only once.


If you want to remove the pagination at the bottom you can add such CSS on your website:
.hikashop_products_pagination{display:none;}

Please Log in or Create an account to join the conversation.

  • Posts: 25
  • Thank you received: 0
12 years 2 weeks ago #73016

Hi,

The pagination works.

However I still have the problem of three echoes of 'Hello World'.

This is what my code looks like:

<?php

static $alreadyDone = false;
if($alreadyDone) return;
$alreadyDone = true;

echo "Hello World";


?>

I have never used 'static' before so maybe I have used it incorrectly.
Please show me how to correct this.

Thank You again

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 2 weeks ago #73227

That code is correct.

Static allows you to keep the value in the variable when you come back to that code later on:
www.tutorialspoint.com/php/php_static_variables.htm

Please Log in or Create an account to join the conversation.

  • Posts: 25
  • Thank you received: 0
12 years 2 weeks ago #73300

Hi again,

I tried the code based on the link you provided and this is what I have:-

<link href="css/css.css" rel="stylesheet" type="text/css" />

<?php

function keep_track() {
STATIC $test = "Hello World";
echo $test;
echo " ";
}
keep_track();

?>


This code works since only one "Hello World" is being printed to the page.

However the rest of my website layout has disappeared (all my menus etc) and "Hello World" is being displayed on a plain white page (see attachment).

HOW can I fix this?

Thank You

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82818
  • Thank you received: 13361
  • MODERATOR
12 years 2 weeks ago #73594

Hi,

It sounds like you remove the code of your template or joomla and put a code displaying the text helloworld on your website.
I don't see why you did that but it's doing what you told it to do... Since that's obviously not what you want to do, you should revert your changes.

Look, we're not here to teach you how to code in PHP and I already gave you a solution to a problem relate to custom code. That is already outside normal support. Please hire a 3rd party developer so that he can help you develop what you want to achieve. You can find such joomla developers on joomlancers.com

Please Log in or Create an account to join the conversation.

Time to create page: 0.098 seconds
Powered by Kunena Forum