♥akmac Posted September 19, 2005 Posted September 19, 2005 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.
♥akmac Posted September 20, 2005 Author Posted September 20, 2005 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.
MoisesZaragoza Posted September 20, 2005 Posted September 20, 2005 were are you storing the information of they have a gift Voucher balance at the end of the day the code will be good
MoisesZaragoza Posted September 20, 2005 Posted September 20, 2005 were are you storing the information of they have a gift Voucher balance at the end of the day the code will be good
♥akmac Posted September 20, 2005 Author Posted September 20, 2005 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.
♥akmac Posted September 20, 2005 Author Posted September 20, 2005 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.
♥akmac Posted September 20, 2005 Author Posted September 20, 2005 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.
♥akmac Posted September 22, 2005 Author Posted September 22, 2005 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.
Guest Posted September 22, 2005 Posted September 22, 2005 if ($cart->count_contents() > 0 && $gv_result['amount'] > 0 ) include(DIR_WS_BOXES . 'shopping_cart.php');
♥akmac Posted September 22, 2005 Author Posted September 22, 2005 if ($cart->count_contents() > 0 && $gv_result['amount'] > 0 ) ?include(DIR_WS_BOXES . 'shopping_cart.php'); <{POST_SNAPBACK}> 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.
Guest Posted September 22, 2005 Posted September 22, 2005 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:
♥akmac Posted September 22, 2005 Author Posted September 22, 2005 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.
Guest Posted September 22, 2005 Posted September 22, 2005 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.
♥akmac Posted September 22, 2005 Author Posted September 22, 2005 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. <{POST_SNAPBACK}> 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.
Guest Posted September 22, 2005 Posted September 22, 2005 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?
♥akmac Posted September 22, 2005 Author Posted September 22, 2005 there is a checktep_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? <{POST_SNAPBACK}> 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.
Guest Posted September 22, 2005 Posted September 22, 2005 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.
♥akmac Posted September 22, 2005 Author Posted September 22, 2005 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. <{POST_SNAPBACK}> can I set the var in column_right.php? Might that work? Quidquid latine dictum sit, profundum viditur.
Guest Posted September 22, 2005 Posted September 22, 2005 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
♥akmac Posted September 23, 2005 Author Posted September 23, 2005 Very slick-thank you sir! Quidquid latine dictum sit, profundum viditur.
♥akmac Posted October 7, 2005 Author Posted October 7, 2005 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.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.