Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shopping Cart Box Doesn't Show


akmac

Recommended Posts

Posted

Hi All!

I've got this little snippet in my column_right.php:

if ($cart->count_contents() > 0) include(DIR_WS_BOXES . 'shopping_cart.php');

So that my shopping cart box doesn't show unless something is in the cart. Works great!

 

But, can anyone modify it to include a gift voucher balance in the IF statement so that IF a customer has a Gift Voucher balance-the cart box shows? Right now, it doesn't show.

 

Thanks!

 

If you need some bits and pieces from the ccgv contrib to get it to play-I'm happy to dig for it. I can FIND code-just can't WRITE it ;-)

Quidquid latine dictum sit, profundum viditur.

Posted

Anyone... How would I modify the line to detect whether a gift voucher balance is available-and display the shopping cart box?

Quidquid latine dictum sit, profundum viditur.

Posted

Not sure, but here's a bit of code from the ccgv contribution that might tell you where...?

 

 ?if (tep_session_is_registered('customer_id')) {
? ?$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
? ?$gv_result = tep_db_fetch_array($gv_query);
? ?if ($gv_result['amount'] > 0 ) {

 

THanks!

Quidquid latine dictum sit, profundum viditur.

Posted

Is there such a thing as an "and" statement? It seems to me that something like this should work:

 

if ($cart->count_contents() > 0) and ($gv_result['amount'] > 0 )include(DIR_WS_BOXES . 'shopping_cart.php');

 

 

But it don't.

 

<asking for a php guru to see why the above line causes my right column to disappear =-)>

Quidquid latine dictum sit, profundum viditur.

Posted

if ($cart->count_contents() > 0) and ($gv_result['amount'] > 0 )include(DIR_WS_BOXES . 'shopping_cart.php');

 

Now I know something in this line is killing my whole right_column. Who can tell me what it is? A misplaced character? incorrect phrase? What? Please help...

Quidquid latine dictum sit, profundum viditur.

Posted

if ($cart->count_contents() > 0) and ($gv_result['amount'] > 0 )include(DIR_WS_BOXES . 'shopping_cart.php');

 

Can anyone correct that line so it works?

Quidquid latine dictum sit, profundum viditur.

Posted
if ($cart->count_contents() > 0 && $gv_result['amount'] > 0 )
 include(DIR_WS_BOXES . 'shopping_cart.php');

Posted
if ($cart->count_contents() > 0 && $gv_result['amount'] > 0 )
?include(DIR_WS_BOXES . 'shopping_cart.php');

Thanks Enigma1, for replying (te me and everyone else) everytime I look in here you're answering questions-THANKS. Anyway, for some reason, now the shopping cart box won't show at all...

 

Any ideas?

 

I suppose I need it to show if EITHER there is a gift balance, OR an Item is in the cart, as right now I suppose it's set to only display if both are true (it doesn't). If that makes any sense...

Quidquid latine dictum sit, profundum viditur.

Posted

ok lets try this:

 

if ($cart->count_contents() > 0 || $gv_result['amount'] > 0 )
include(DIR_WS_BOXES . 'shopping_cart.php');

 

I dont have the gifts contrib installed so its a lot of guesswork really :lol:

Posted

Progress! Now it shows with an item in the cart-but not if there is just a GV balance....

Quidquid latine dictum sit, profundum viditur.

Posted

is that $gv_result array a global variable? Can you find out where it is defined? Has to be a global otherwise you're comparing with something undefined.

Posted
is that $gv_result array a global variable? Can you find out where it is defined? Has to be a global otherwise you're comparing with something undefined.

 

 

The code from post number 5 is in catalog/includes/boxes/shopping_cart.php

 

  $gv_result = tep_db_fetch_array($gv_query);

 

Does that help?

Quidquid latine dictum sit, profundum viditur.

Posted

there is a check

tep_session_is_registered('customer_id')

 

meaning someone has to be logged in and has also an entry in this coupn table. Did you check if both of these conditions are met when you checked the cart box?

Posted
there is a check

tep_session_is_registered('customer_id')

 

meaning someone has to be logged in and has also an entry in this coupn table. Did you check if both of these conditions are met when you checked the cart box?

 

 

Yes, I was logged in with a gift voucher balance. When I add an item to my cart, the cart shows, but not before.

Quidquid latine dictum sit, profundum viditur.

Posted

ok I see the file the var is set inside the shopping_cart.php box itself so aint going to work you will have to change that file or theoretically you should always include the shopping cart box because there is a check in there for the contents and the coupons. At least thats the intention of the code as I understand it.

Posted
ok I see the file the var is set inside the shopping_cart.php box itself so aint going to work you will have to change that file or theoretically you should always include the shopping cart box because there is a check in there for the contents and the coupons. At least thats the intention of the code as I understand it.

 

can I set the var in column_right.php? Might that work?

Quidquid latine dictum sit, profundum viditur.

Posted

yes you could. Just a bit of duplicate code and queries if thats ok:

// ############ Added CCGV Contribution ##########
?if (tep_session_is_registered('customer_id')) {
? ?$gv_query = tep_db_query("select amount from " . TABLE_COUPON_GV_CUSTOMER . " where customer_id = '" . $customer_id . "'");
? ?$gv_result = tep_db_fetch_array($gv_query);
? ?if ($cart->count_contents() > 0 || $gv_result['amount'] > 0 ) {
? ? ?include(DIR_WS_BOXES . 'shopping_cart.php');
? ?}
?}

something like this

  • 2 weeks later...
Posted
Very slick-thank you sir!

 

Weird. It worked for awhile, now the cart box doesn't show at all! Something to do with those duplicate queries maybe? I haven't messed with it at all-promise!

Quidquid latine dictum sit, profundum viditur.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...