Zen Cart Logo
Forums / General Questions / Correct syntax for Add to Wishlist link

Correct syntax for Add to Wishlist link

Locked

Views: 2,541

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
6 Nov 2006, 4:45 AM
#1
magicpants avatar

magicpants

Zen Follower

Join Date:
Aug 2005
Posts:
314
Plugin Contributions:
0

Correct syntax for Add to Wishlist link

We're using the previous order page (tpl_account_history_info_default.php) a bit differently, and are trying to put Add to Cart and Add to Wishlist buttons next to each previously ordered product of the customer's.

A programmer made the following code for us to add an Add to Cart button. This works fine:

<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($order->products[$i]['id']), zen_get_all_get_params(array('action')) . 'action=add_product&zenid=' . session_id()), 'post', 'enctype="multipart/form-data"'); ?>
<?php echo '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', $order->products[$i]['id']) . zen_image_submit(BUTTON_IMAGE_ADD_TO_CART_SMALL, BUTTON_IN_CART_ALT);//$template->get_template_dir(BUTTON_IMAGE_IN_CART, DIR_WS_TEMPLATE, $current_page_base, 'buttons/' . $_SESSION['language'] . '/' . BUTTON_IMAGE_IN_CART); ?>
</form>

I'm trying to figure out how to add an Add to Wishlist button just like it and so far, I can't get it to work. The latest I have is this:

<?php echo '<a href="' . zen_href_link(UN_FILENAME_WISHLIST, 'products_id=' . $listing->fields['products_id'] . '&action=un_add_wishlist') . '">' . zen_image_button(BUTTON_IMAGE_ADD_WISHLIST_SMALL, BUTTON_ADD_WISHLIST_ALT) . '</a>'; ?>

It's almost working, I think. But, the product_id isn't getting included in the link. I'm not sure what to write in the above code to make it grab the correct product id. You can see here what's actually being generated right now:

http://myshop.com/catalog/index.php?main_page=un_wishlist&products_id=&action=un_add_wishlist

Any help would be greatly appreciated!

7 Nov 2006, 4:49 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Correct syntax for Add to Wishlist link

Assuming your wishlist link is somehow right next to the add-to-cart link, I would suspect that this:$order->products[$i]['id']might be better than this:```
$listing->fields['products_id']

26 Jun 2009, 2:56 PM
#3
hardwiredtemplates avatar

hardwiredtemplates

Zen Follower

Join Date:
Sep 2008
Posts:
211
Plugin Contributions:
0

Re: Correct syntax for Add to Wishlist link

DrByte:

Assuming your wishlist link is somehow right next to the add-to-cart link, I would suspect that this:$order->products[$i]['id']might be better than this:```
$listing->fields['products_id']


Hey Doc, I have this in my tpl_product_info_display.php file. One I am logged in and hit add to link button on a product it get the secure/non secure page error (Kinda Scary). I've tried other suggestion from several other threads but can't seem to get this to work

So How can I make this page SECURE? somehow add the SSL in the right place:frusty:

Please see link below: <http://fashionfavourites.com/index.php?main_page=product_info&cPath=4_290_243&products_id=1086>
26 Jun 2009, 3:08 PM
#4
hardwiredtemplates avatar

hardwiredtemplates

Zen Follower

Join Date:
Sep 2008
Posts:
211
Plugin Contributions:
0

Re: Correct syntax for Add to Wishlist link

hardwiredtemplates:

Hey Doc, I have this in my tpl_product_info_display.php file. One I am logged in and hit add to link button on a product it get the secure/non secure page error (Kinda Scary). I've tried other suggestion from several other threads but can't seem to get this to work

So How can I make this page SECURE? somehow add the SSL in the right place:frusty:

Please see link below: http://fashionfavourites.com/index.php?main_page=product_info&cPath=4_290_243&products_id=1086

Sorry the code I am trying to include the SSL is:
echo '<a href="' . zen_href_link(UN_FILENAME_WISHLIST, zen_get_all_get_params(array('action', 'products_id')) . 'products_id='.(int)$_GET['products_id'].'&action=un_add_wishlist') . '">' . zen_image_button(BUTTON_IMAGE_ADD_WISHLIST,BUTTON_ADD_WISHLIST_ALT) . '</a>';

I know with http: can be modified to https: but not a clue on how to do this with above code...