Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

WishList Modification


sandwick

Recommended Posts

Posted

I would like to insert the products_model into the customer_wishlist database.

 

I have already added the field products_model to the costomers_wishlist database.

 

I have located the wishlist class that will do it below, but do not know how to modify it to include the

 

products_model

 

function add_wishlist($wishlist_id, $attributes_id) {
global $customer_id;


  if(!$this->in_wishlist($wishlist_id)) {

$wishlist_id = tep_get_uprid($wishlist_id, $attributes_id);
// Insert into session
$this->wishID[$wishlist_id] = array($wishlist_id);

if (tep_session_is_registered('customer_id')) {
// Insert into database
tep_db_query("insert into " . TABLE_WISHLIST . " (customers_id, products_id) values ('" . 

$customer_id . "', '" . $wishlist_id . "')");
		}

	// Read array of options and values for attributes in id[]
if (is_array($attributes_id)) {
	reset($attributes_id);
	while (list($option, $value) = each($attributes_id)) {
		$this->wishID[$wishlist_id]['attributes'][$option] = $value;
	// Add to customers_wishlist_attributes table
	if (tep_session_is_registered('customer_id')) {
		tep_db_query("insert into " . TABLE_WISHLIST_ATTRIBUTES . " (customers_id, products_id, 

products_options_id , products_options_value_id) values ('" . $customer_id . "', '" . $wishlist_id . "', 

'" . $option . "', '" . $value . "' )");
				}
		}
		tep_session_unregister('attributes_id');
	  }
}
}

 

 

Located in products_info.php is the following link at the bottom of the page ... and I have add the

 

$product_info['product_model'] just like the product_info['product_id'] to be passed. ( do not know

 

if this is right )

 

<td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', 

$product_info['products_id'], 'products_model', $product_info['product_model']) . 

tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td>

 

 

This is the code in application_top.php

 

  if(isset($HTTP_POST_VARS['wishlist_x'])) {
if(isset($HTTP_POST_VARS['products_id'])) {
	if(isset($HTTP_POST_VARS['id'])) {
		$attributes_id = $HTTP_POST_VARS['id'];
		tep_session_register('attributes_id');

	}
	$wishlist_id = $HTTP_POST_VARS['products_id'];
	tep_session_register('wishlist_id');

}
tep_redirect(tep_href_link(FILENAME_WISHLIST));
 }

 

 

 

WHAT / WHERE / HOW do I need change this so when they click on add to wishlist that it includes

products_model being inserted into the database !!!

 

Any suggestion would greatly be appreciated !!!

 

 

// Larry

Archived

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

×
×
  • Create New...