PDA

View Full Version : Making Wishlist page to display all customers' wishlists.



dan1234
11-02-2011, 10:20 AM
I want to make a wishlist lookup page so that people that come into the brick and mortar store can look up someone's wishlist by bringing up a list of people that have wishlists and clicking on the one of their choice. I have created a page to generate a list of customers that have a wishlist but the link to their wishlist is not coming out correct. I am using the following code:

<table border="0" cellspacing="0" cellpadding="2">
<?php
# Get specific list data
$customers_query_raw = tep_db_query("select customers_id, customers_firstname, customers_lastname from " .
TABLE_CUSTOMERS . " where customers_id = '".$HTTP_GET_VARS['cid']."'");
$customers = tep_db_fetch_array($customers_query_raw);
?>
<tr><td>
<?php if (isset($HTTP_GET_VARS['cid'])) {
echo '<a href="' . tep_href_link(FILENAME_WISHLIST_PUBLIC, 'public_id=' . $customers['customers_id'], 'NONSSL') . '"><span class="pageHeading">' . $customers['customers_firstname'] . ' ' . $customers['customers_lastname'] . '</span></a>';
}else{
echo tep_draw_separator('pixel_trans.gif', 1, 1);
} ?>
</td></tr>
</table>

It generates a complete wishlist fine but the link is incorrect. The link comes out as just http://...../wishlist_public.php and thus reverts to the index page.

I think my error is in the line <a href="' . tep_href_link(FILENAME_WISHLIST_PUBLIC, 'public_id=' . $customers['customers_id'], 'NONSSL') . '">

I have tried to write it several ways but cannot get it to include ?public_id=1 at the end of the link.

Can anyone point me in the right direction?

Thanks,

Dan

pgmarshall
11-02-2011, 10:35 AM
I think you are mixing your ' 's too much ... make $customer['customers_id'] a variable then call it in the href construct. Also you seem to be mis-using the PHP ... Try something like:

<?php
$cus_is = $customer['customers_id'];
?>

<a href="<?php echo tep_href_link(FILENAME_WISHLIST_PUBLIC, 'public_id=' . $cus_id, 'NONSSL'); ?>">Your link</a>

Regards.

ridexbuilder
11-02-2011, 11:31 AM
You will need to keep in mind that you cannot show people someone else's details (name, for example) on the list, unless your country has no Data Protection Act. For a Wedding Wish List, for example, you may need the originator and client to sign a disclaimer. It depends on what application that you're putting this list to.

On the coding front:
$HTTP_GET_VARS should be replaced with $_GET