Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I apologize for asking the same question several ways... I'm trying to solve a problem that seems like it should be simple, but is turning out to be a total drag.

My client is using Drupal 7 and Commerce. They have a supplier with custom pricing tables based on logged in Customer. I get back the unit price for a line item like so:

    $result = drupal_http_request('http://vendorwebsite.com?CartID=12345&Seq=1&Part=' . 

$jch_product_title . '&Dim1=240&Quantity=1', $options);

...Now, I need to know where to put this code so that the returned price will ALWAYS override the unit price in the Commerce store line item.

I -thought- I could use hook_commerce_cart_product_add to override the price pulled in from the Products note, but I can't find an example on how to do this.

So, I then thought I could add my PHP to a Product Pricing Rule Action, but again, I'm stumped as to how to do this. So far: Condition: Order Is A Cart

...and.... I'm stumped. 1. How do I get address the line item unit price about to be added? (What is the var in the Data Selector?) And then... 2. How do I get the PHP Custom Code textarea to appear so I can type in my code?

...OR...if there's a better way to do this, I'm all ears!

TIA,

---JC

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.