0

I'm using Commerce Quotes sandbox project (https://www.drupal.org/sandbox/xatoo/1860944) to get quote system in commerce. Customer add products to cart and requests a quote instead of checkout. Then store owner can respond to quote (store owner may give discounts to product s unit price) and system sends new quote to customer by email. Then customer can accept or decline the offer.

My problem is that if customer accepts the offer he/she should be able to pay the order in the website. Is there some url I could redirect customer to? I tried following approach with Rules:

  • After accepting quote change Order status to "Checkout: Shipping"
  • Redirect customer to /checkout/[order_id]/shipping

The problem was that now in checkout product prices were original, not the discounted one that store owner was saved to order. Any idea why is that?

Is there better way to let customer pay the accepted offer?

Big thanks in advance!

1

Sounds to me like the sandbox isn't using pricing rules to set the "new offer."

Here's what I would do (without knowing what the sandbox is doing):

  • I would create a custom line item type using commerce_custom_product
  • I would then add a price field called "price_override"
  • I would then create a pricing rule that overrides the original price of the line item with the "overridden price" if it exists.
  • I would then make sure that the sandbox or a custom module sets that line item field when a new offer is made

The above approach has the benefit that the price is actually using pricing rules, but the "custom price" is per-line-item instead of per-order. Now it might be possible, depending on how the sandbox is functioning, to access the "custom pricing" and use it in a pricing rule. But the same approach would still be taken above.

// Edit

You can always just send users to "/checkout" ... but likely they would need to be logged in first to be connected to their order (this would be based on default permissions). So I would use the Drupal system to your advantage, this little link will present anonymous users with a login form, then redirect to checkout (and will simply redirect to checkout if logged in):

/user/login?destination=checkout

  • Thanks for your reply! The new discounted price is shown in the quote email sent to customer and also in the review page where customer can accept or decline the quote. I also checked the order as an administrator in backend and the new prices are visible in order's line items. BUT when customer accepts the quote and go to checkout, the new discounted prices are gone. I don't get it why the original prices are back even new prices are saved and visible in backend before checkout. But maybe I should try your suggest, I think it will work. – rautiainent Jan 18 '16 at 21:00
  • Its likely intercepting the price somewhere outside the pricing rules (this is often the case with sandboxes and people that don't understand the pricing rules). Try this: Create a test quote with different prices, then click edit on the order and click "Apply Pricing Rules" and see if the prices change. If they do, they're not using the pricing rules system. – joshmiller Jan 18 '16 at 21:18
  • You are right, prices change to original when I run "Apply Pricing Rules". So I have to get known pricing rules logic to build this again. Thanks a lot for tips! – rautiainent Jan 18 '16 at 21:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.