Let me first say i was ABSOLUTELY DELIGHTED to find this module and test it out. Thank you for sharing this as it will save a lot of time - it worked as expected EXCEPT for the following...
I have a client who has a rather complex pricing structure, thus we are utilizing the "Custom Price" module (here: http://drupal.org/project/uc_custom_price) to modify the base price (sale price). My problem is that this module doesn't take these custom price modifications in to account and submits the initial sale price to Google instead of the adjusted sale price.
Does anyone have any advice on how i can get this to be accounted for when submitting the price for a given product to Google?
I did find line 527 in uc_gbase.module:
$item->add_attribute('price', $node->sell_price, 'floatUnit');
which appears to be what grabs the sell_price.
I was hoping i could just implement the custom price function to account for the custom price modifications here instead... something like:
$node->sell_price = uc_custom_price_cart_item('load', &$node);
$item->add_attribute('price', $node->sell_price, 'floatUnit');
...but that's not working for me. Can you see what i'm doing wrong? I admit I'm still getting acquainted to Drupal's code contexts...
As a first step, I have been attempting to at least figure out how to print the eval'd custom price code on the product theme node-product.tpl. it seems like it should be easy to print the evaluated custom price!!...
...but i cannot get it to work. Here's what i have at the moment, which i have adapted from uc_custom_price.module on line 22:
$code = db_result(db_query("SELECT custom_code FROM {uc_custom_price} WHERE nid = %d", $nid));
print "
code: ".$code;
if (!empty($code)) {
$product = node_load($nid);
$eval_code = token_replace_multiple($code, array('node' => $product, 'uc_cart_item' => $item));
print "
eval_code: ". $eval_code;
eval($eval_code);
$temp_custom_price = eval($eval_code);
Here's what i get:
code: $item->price = $item->price; if($item->qty < 300) { $item->price = $item->price*1.20; $item->price = round($item->price, 2); } $item->price = ($item->price*1.07); $item->price = round($item->price, 2);
eval_code: $item->price = $item->price; if($item->qty < 300) { $item->price = $item->price*1.20; $item->price = round($item->price, 2); } $item->price = ($item->price*1.07); $item->price = round($item->price, 2);
temp_custom_price:
So essentially it looks like the tokens in the code aren't being replaced correctly, but after hours of trying to wrap my mind around this, i can't figure out what I'm doing wrong. I'm not sure where to look regarding what to use within the token_replace_multiple function to get it to work. I found the api reference but i need more examples, i suppose.
Do anyone have any advice? Any advice or comments that could help me out would be greatly appreciated!
Comments
Comment #1
SchwebDesign commentedIt's been over a week- does anyone have any feedback regarding this? I understand it's a busy time of year- no problem. Thanks!
Comment #3
MixologicI havent worked with this module, however I think I can identify a conceptual error on your part. When you are submitting products to google base/merchant center, there is no opportunity for 'custom prices'. You tell google base what the price is when you submit the products. At that stage, there is no 'quantity' to base the price on, as its not part of an order.
from the google merchant help pages: http://www.google.com/support/merchants/bin/answer.py?answer=188494