I am trying to extend the E-Commerce module to include a 'quotation' cart feature. The quotation cart module will show the products without any prices, instead, the customer makes a list of he desired products (together with the required quantity etc) and submits it to the shop owner as a quotation request. The shop owner will receive the quotation with input spaces to enter the prices and by submitting the quotation it will be emailed to the customer as a pdf file.

Here is a question for the E-Commerce module developers:

- What is the best way to implement the described quotation cart module?
(1) By overriding the existing functions; or
(2) By copying the existing structure and modifying the existing functions.

Of course, the first approach is more desireable as it allows a light-weight module to be integrated to an existing system. However, the problem is that I am not sure how 'overridable' the e-commerce module is. Here is a list of main changes which the quotation cart module needs to perform:

- The prices should be hidden in the products list and products detail
- Theere is no prices in the shopping cart, No subtotals.
- Everything to do with 'shopping' should be changes to 'Quotation', eg, 'Add to quotation cart'.
- There is no payment page.

Comments

nedjo’s picture

Before 4.7, these changes are likely impossible to do without hacking the ecommerce modules, e.g., product.module. If you wait for a 4.7 release (or, help with the work of getting one out), you'll have a much better toolset--mainly, the Forms API, which allows you to do the sort of modifications of an existing form that you're looking for.

That said, I did something roughly comparable for a client, hacking in a new _productapi hook option. Modified lines in product_get_base_form_elements($edit):


  if ($price = module_invoke($edit->ptype, 'productapi', $edit, 'price_elements')) {
    $output .= $price;
  }
  else {
    $output .= form_textfield(t('Price'), 'price', $edit->price, 25, 50, t('How much does this product retail for? Note: This price may be different from the selling price due to price adjustments elsewhere.'). $help);
  }

And a sample snippet from a _productapi hook:


    case 'price_elements':
      return form_hidden('price', $node->price);

buendia’s picture

Thanks for the reply nedjo.

(1) How long roughly does it take for the new release to come out?

(2) Based on what you wrote, my understanding is that it is not possible to extend the module without modifying the existing files. The trouble with this is that when a new release comes out my extension is not going to work anymore.

(3) I udenrstand that there are a lot of debates about why drupal is not object-oriented (or at least not class-based). I think this example is a good evidence to indicate the fact that a class-based structure brings less trouble to open source community when it comes to extending the existing work non-intrusively. When I trace the history of the modules I can see a lot of non-compatibility with a tiny older version. that is, if I write a module today, it is very likely that the module will not work a new version of drual in 6 months. It seems to me if drupal was class-based it would be more stable to keep existing modules alive.

deligeng’s picture

I don't think it's a real problem to modify the ecommerce module. Simply check out their CVS version and work on it. I believe the majority work of the quotation module is outside of the current ecommerce module. So the actually modification of the ecommerce should not be much. And the change can be submitted by a diff, or it might be applied by a patch on a new CVS checkout.

nravens’s picture

I need a module for a quotation cart rather than a shopping cart.

Example of what I'm looking for: Customers would need to select the product type and choose the required size/s (there are 3 different sizes). The selected products and sizes required needs to be add to the quotation cart. On checkout the request for quotation needs to be sent to the product supplier who would then reply to the customer via email with the quotation.

Is it possible to use any existing module/s to achieve this?

nravens’s picture

I've installed Ubercart and customized it to do what I need it to do. There are still a few minor issues I need to figure out but it seems Ubercart is a good e-commerce solution with enough customization options and modules.

trep316’s picture

May I ask how did you accomplish the RFQ modification in ubercart? I want to accomplish the exact same same effect, thanks.