Jump to content

Archived

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

j.smith1981

X Cart products prices amendment (php code side).

Recommended Posts

Hi has anyone by any chance had much experience with X carts code?

 

I need some help, with v4.1.11, the x cart forums are really quiet for some reason the past week or so, tried posting there got one reply but not much else.

 

OK, all I am wanting to do, is change where X carts system, when displaying product prices, is to change where it looks for them, but based on some of the customers credentials, like we are going to have (not set in stone at the moment), but say Product 1 was £20 in post code HG2 and its now a different price in HG3, sort of like, well much like a matrix system.

 

Only the user doesnt get to change the matrix options, like say shirt sizes S M or L they woiuld be automatically given L based on their location geographically.

 

This is to allow some of our providers on the site to amend their prices as and when, but this is the first step in doing that.

 

I have listed the code as per below:

 


	// I think this is where we can change the SQL to make this work properly! $product['price']; is where the value is for $product['taxed_price']

	// ID number of product is: $productid

	// Now to get the customer ID, try to output the session variable and values

	// New test query!

$products_pcode_price_query	= "SELECT xcart_class_options.price_modifier AS price, FROM xcart_customers, JOIN xcart_class_options ON LEFT( xcart_customers.b_zipcode, INSTR( xcart_customers.b_zipcode, ' ' ) ) = xcart_class_options.option_name, JOIN xcart_classes ON xcart_class_options.classid = xcart_classes.classid, WHERE xcart_classes.productid = '$productid'  AND xcart_customers.login = '$login', GROUP BY xcart_classes.productid";

$result = mysql_query($products_pcode_price_query); // Should bring back some results as per the users login!

	$product['taxed_price'] = $product['price']; // = $result['price']; -- this I tried adding in to change the value but doesnt seem to change it at all

 

This also includes the following which I believe to be relevant:

 

		if (!$always_select && ($product["forsale"] == "N" || ($product["forsale"] == "B" && empty($pconf)))) {
		if ($redirect_if_error)
			func_header_location("error_message.php?product_disabled");
		else
			return false;
	}

	if ($current_area == "C" && !$clear_price) {
		#
		# Calculate taxes and price including taxes
		#
		global $login;

		$orig_price = $product["price"];
		$product["taxes"] = func_get_product_taxes($product, $login);

		# List price corrections
		if (($product['taxed_price'] != $orig_price) && ($product['list_price'] > 0))
			$product['list_price'] = price_format($product['list_price'] * $product['taxed_price'] / $orig_price);
	}

} else {
	$product['is_thumbnail'] = func_query_first_cell("SELECT id FROM $sql_tbl[images_T] WHERE id = '$product[productid]'") != false;
	$product['is_pimage'] = func_query_first_cell("SELECT id FROM $sql_tbl[images_P] WHERE id = '$product[productid]'") != false;
}

 

So the user logs in, their in HG2 they'll see a product and it will be different price to the same product in another postcode, I am really confused now as to what to do with the syntax to get this working effectively.

 

Can someone help me?

 

Thanks again in advance,

Jeremy.

 

Thanks in advance,

Jeremy.

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.