the canada post shipping module doesn't work with the shipping estimator unless the customer is logged in. there's been a number of threads trying to fix this problem, but no luck.
as it is now, a not-logged-in customer who clicks the "estimate shipping" button on the shopping cart page on my site will get the little pop-up window to come up, but it won't work at all.
so i want to prevent not-logged-in customers from seeing the "estimate shipping" button in the first place.
in fact, what i'd like to do is put a different button or message in the same place, saying "please login to estimate shipping costs". that would link to the login page.
so what i need is a php command with the following logic:
(1) if login=true, then display "estimate shipping" button
(2) if login=false, then display "login for shipping" button
obviously i'll have to define BUTTON_IMAGE_LOGIN_FOR_SHIPPING_ESTIMATOR at some point. that's no problem. i just need help with how to code the if/else statement for logged in status.
the relevant code is in templates/tpl_shopping_cart_default.php :
the code is a bit more complicated than it would be because of the switch in admin-->configuration-->shipping which lets you decide whether to display a shipping estimator button (for the popup) or just the actual estimate on the same page. i'm planning to use a button, meaningCode:<?php switch (true) { case (SHOW_SHIPPING_ESTIMATOR_BUTTON == '1'): ?> <div class="forward"><?php echo '<a href="javascript:popupWindow(\'' . zen_href_link(FILENAME_POPUP_SHIPPING_ESTIMATOR) . '\')">' . zen_image_button(BUTTON_IMAGE_SHIPPING_ESTIMATOR, BUTTON_SHIPPING_ESTIMATOR_ALT) . '</a>'; ?></div> <?php break; case (SHOW_SHIPPING_ESTIMATOR_BUTTON == '2'): /** * load the shipping estimator code if needed */ ?> <?php require(DIR_WS_MODULES . zen_get_module_directory('shipping_estimator.php')); ?>
but i guess the proper way to code this would be to embed the switch (case 1 vs case 2) within the (if login vs if not-login) statement. that way logged in customers would see either the button or the shipping estimate, depending on how the switch is set, and not-logged in customers wouldn't see it either way.Code:case (SHOW_SHIPPING_ESTIMATOR_BUTTON == '1'):
hope that makes sense...
Bookmarks