Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

can you add a cust ID to a product and show in cust account?


Platinum Games

Recommended Posts

Hello all i need to be able to assign a customer_id to a product when it is listed on the site, also i would need to be able to display each product that is connected to the lactive customer_id

 

eg:

 

john Smith has an account

 

so when John is logged in to the site and goes to his account he can see the listed items attached to his customer_id.

 

i would like to be able to add a drop down list of each customer name and email in the admin/categories.php? to assign the product

 

and create a new page (items.php) for the customer to see what items are attached to them.

 

i think i could copy some code from current admin pages but just need a little help.

Thanks in advance!

 

Ben

Link to comment
Share on other sites

ok now i have worked out how to add a customer_id to the product through the admin/categories.php

 

i have added a field to the PRODUCTS TABLE called customer_id

 

so now i can add a cust id to each product i list.

 

Now my issue i have now is i would like to display a list of items for each customer (in their own account)

 

i have created a page called (my_items.php) in the CAT DIR

 

i have made it accessible to members only, so when the member logs in they can see the items i have linked them too.

 

So this is what i have!

<?php
$products_listed_query = tep_db_query ("select products_id, customers_id, products_image, Products_price, products_date_added, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where customers_id = '" . (int)$customer_id . "' order by products_date_added desc");
$products_listed = tep_db_fetch_array($products_listed_query);

  if($products_listed) 
	 {
	while ($TempArray = tep_db_fetch_array($products_listed))
		 {
		 $listed_image = stripslashes($TempArray['products_image']);
		 $listed_name = stripslashes($TempArray['products_name']);
		 $listed_price = stripslashes($TempArray['products_price']);
		 $listed_date = stripcslashes($TempArray['product_date_added']);
		  $DisplayStr .= $listed_image . ' ' . $listed_name . ' ' . $listed_price . ' ' . $listed_date . '<br />';
		  }
	  echo '<div class=\'members\'>' . $DisplayStr . '</div>';
	//echo $DisplayStr;		

	  }


?>

 

and i get this error!

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/xxxxxxx/public_html/shop/includes/functions/database.php on line 99

 

 

can someone please tell me what i have done wrong as i am not a coder!

 

Thanks

Thanks in advance!

 

Ben

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...