Hi Docc,

Just a note to let you know I'm still working on things. What have I been working on so far;

  • Multiprice i18n/language support
  • Multiprice import
  • Multiprice role support
  • Multiprice currencies

Multiprice i18n/language support
This has been fixed and comitted ofcourse, see http://drupal.org/node/913660

Multiprice import
I have a working version as a separate helper module which allows a maintainer to;

  • Upload a delimited text file per country (will implement per role price imports as well)
  • Set delimiter and enclosure
  • Map values of delimited file to SKU, sell price, cost, list price

If one has installed the module by Firewing1 (http://www.firewing1.com/node/27) to synchronize ubercart fields the imports work accross all translations given that a sku doesn't change between translations which it shouldn't ofcourse. The import is run as a batch. I have looked at other import modules but that seemed much more work and would create dependencies which I don't opt for as I don't have much time to maintain and I guess you don't either :)

Multiprice role support
Still working on this. I have a working version build into uc_multiprice.module as I couldn't make this a helper module, but still have to implement this so it also works with multiprice dynamic price. What I have done is create a settings page where one can choose which roles should have different prices. Prices based on role overrule country based pricing. I have created this so a webshop can sell to regular visitors based on their country and sell to users with a wholesale role. I know of the module UC Price per role (http://drupal.org/project/uc_price_per_role) but couldn't get this module to play nice with multiprice module. Besides, implementing this feature in to UC Multiprice would allow to use the other new features like price import for role based pricing as well.

  • Multiprice currencies
  • A bug I just stumbled upon is the following; let's say you have enabled 3 countries;
    - default: Netherlands (currency sign: €)
    - Australia (currency sign: AU$)
    - United States (currency sign US$)

    If you set pricing for product x to be the following:
    - default sell price: 10
    - US sell price: 15

    The module will show €10 for people who selected Netherlands, show US$15 for people who selected United States, but shows AU$10 for people who selected Australia as their country.

    It falls back to the default price but uses the selected country's currency. This is very costly!!! AU$10 is only about €6,50....

    I will look into this ASAP!

    Are there any other things I need to keep an eye out for while I'm working on the above features?

    Cheers

    Support from Acquia helps fund testing for Drupal Acquia logo

    Comments

    Bartezz’s picture

    Hey Docc,

    A short not to let you know about the progress I've made;

    • Multiprice i18n/language support done, tested and has been committed by yourself
    • Multiprice import working version but have to add role support and enhance features
    • Multiprice role support done and tested
    • Multiprice currencies bug Unfixable

    The multiprice currencies bug has had my brain run at high rpm. Basically this can't be fixed as it is now. Let me explain;

    Like I said before if you have set a currency for a country but not have set a price for this country the module will do a fall back on the default country price. Truning amounts in Euro (€10) into the same amount in the country currency (AU$10). Now I could fix this and make the module not use the country's currency if there has not been set a price. But this would creat huge trouble in checkout, order processing and payment modules.

    Let's say a customer added 3 products, two of which have a country price, one does not;
    product ABC -> AU$15,00
    product DEF -> AU$25,00
    product GHI -> €10

    This would accumulate to a total amount of 50... 50 what? Not AU$, not € but a mix of currencies so an amount that isn't correct.
    The only fix I can think of is, when a user has enabled Multiprice Currencies and a price has not been set for a product for the current country to set the price to 0.00 -> product unorderable. Well one can order it but isn't paying for it and thus the vendor doesn't have to return money or ask for more money later on when the order has been send.

    What do you think?

    Cheers

    Docc’s picture

    Well its correct logic and this only happens when a customer switches country and already has products in its cart.

    This can indeed be a problem. At the time i solved it by deleting all products from the cart when someone switches country.

    At the time it was really a quick fix to get the project live (and wich i ddid not submitted to the module on drupal). But if you have a better idea let me know.

    Docc’s picture

    Bartezz’s picture

    Hey Docc,

    No it doesn't only happen when switching really. I never switched and did encounter this bug. Maybe I didn't explain right;

    Let's see that revised checkout list again;
    product ABC -> AU$ 15,00
    product DEF -> AU$ 25,00
    product GHI -> AU$ 10

    For product ABC and DEF the admin has set the default price in Euro and the price for Australia in AU$. For product GHI he set a default price in Euro and he did not set a price for Australia in AU$, maybe he forgot ;)

    The system would thus charge an amount of 10, because 10 was the default price. Yet the default pricing is in Euro.
    But the amount of 10 charged is in AU$, not Euro. AU$ 10 is not the same as €10 (yes in amount, but not in value). So the customer is paying way too little for the product!

    Hope you understand better now :)

    Cheers

    Docc’s picture

    Yep, and like i said this is how it supposed to be. A correct logic to my understanding.
    If your store manager forgets to add a multiprice its his ass ;)

    It always uses the default price when no multiprice is found for that country. This is independent of the currency.

    If you have a better logic for this then please let me know.

    Docc’s picture

    Maybe a configuration option that can be set to prevent a product to be sold when no multiprice has been defined for the selected country

    Bartezz’s picture

    Yeah something like that, have to look into the options I have. I understand the logic but a small lack of attention by a maintainer can cost deerly. If a price hasn't been set for country India and it falls back to default price amount in Euro for instance. One could buy a laptop for 1000 rupees instead of €1000 ;)

    Probably disable the add to cart button and the price for a product when the admin has set the config option.

    I will post a patch somewhere next week, probably tuesday. This will include role support and import support. The code by Firewing1 to support i18n sync for ubercart is something that should be a standalone module. Yet with the patch I'll provide i18n sync will be supported if Firewing1's module is enabled and configured.

    Cheers

    Bartezz’s picture

    Hi Docc,

    Haven't had time to look into the config option we discussed in #6 yet. Also I haven't completely finished the multiprice import features. But here's a patch that fixes all other issues and adds the price per role support. One issue I hadn't encountered yet was that once you enable a country, then set a price for a product and then disable a country, the module will still show the price for that country. Also on the node/edit form it would show the prices for this country but without the name, which is logical when you look at the query 'SELECT country_id, country_name FROM {uc_countries} WHERE version > 0 ORDER BY country_name ASC'. I've fixed this, also in the patch. The module now shows 'disabled' next to the fields of prices.

    I've run the module thru coder tough love module and changed/cleaned up some stuff here and there. It's all up to Drupal coding standards now.

    Hope you like what you see. I will look into the config option #6 and import feature ASAP and post a patch on that too.

    Cheers

    Bartezz’s picture

    FileSize
    62.39 KB

    Bugger... also change the menu... didn't add that to the patch, please see revised patch!

    Cheers

    dfylstra’s picture

    Just a user comment - Happy to see you working these new features. I'm building a new site / store / cart where I do need both the Price Per Role functionality and the Price Per Country functionality. We sell products at fixed prices in USD, GBP and EUR, but we offer special prices to academic users and government users. I'm looking forward to a new release and I've made a small donation.

    Bartezz’s picture

    Hi dfylstra,

    Thanx for your enthousiasm! I'll contact Docc and see what the status is.
    Have you tried the patch at all? I've not come accross any bugs myself but the more eys on it the better :)

    Cheers

    Bartezz’s picture

    A little more patience, Docc will look at the patch later this week.
    I'm still working on a patch that fixes #7... hopefully I'll be in time ;)

    Cheers

    Bartezz’s picture

    Ok, here is my patch again. It's against 2.x-dev so forget my previous patches.
    I have added the config option(s) as discussed.

    What does this patch add;

    Role based pricing
    A new settings page has been added under admin/store/settings/multiprice/roles
    Here a user with 'administer multiprice roles' permissions can set which roles will/can be getting different prices. Due to the fact that Drupal doesn't add weight to roles and a user can have multiple roles it's very recommended to install http://drupal.org/project/role_weights although this is not a dependency of the module. Role pricing overrides country pricing. Also, when a user has a role that has been enabled in uc_multiprice, the multicurrency price handler will be disabled for that user and the store default currency will be used.

    Multicurrency fixes
    Two options have been added to solve multicurrency problems. As discussed in #4 there are some problems if using the multicurrency price handler whilst not entering country prices for each product. On admin/store/settings/multiprice/currencies one can now select 'Disable unpriced product'. By selecting this a product that has no price set for the user's country will be disabled if the multiprice currency handler is enabled. Thereby preventing the sale of a product for the wrong price.

    When role pricing is enabled the module will now first check if there is a price set for one of the user's roles, if not it will see if there is a price set for the user's country. Now if the currency of the user's country differs from the store default currency this will also cause problems. Therefor one can select 'Multiprice roles fallback' under admin/store/settings/multiprice/roles. If no role price is found then the module will switch back to the default product price. Which is always in the same currency as a role price.

    It's been quite a ride, hope you enjoy :)

    Cheers

    Bartezz’s picture

    Status: Active » Needs review

    Oops, forgot the change status!

    dfylstra’s picture

    Category: feature » support

    Thank you Bartezz for posting this patch file. I have downloaded Multiprice 6.x-2.x-dev and applied this latest patch to it. On the site I'm building, I've installed the Countries API 6.x-1.1 and IP Country 6.x-1.x-dev modules, and I'm about to try the Multiprice module with your patches.

    Looking at the patched uc_multiprice.install file, I see that uc_multiprice_update_6003() adds a new field role-id to the uc_multiprice table. Because I have no previous installation of the Multiprice module, I think I should add this field to the schema definition of the uc_multiprice table in uc_multiprice_schema(). Do you agree?

    One other question: We normally offer certain price discounts (fixed amounts in each currency) when a customer buys certain combinations of products. I was thinking of installing the UC Discount Alt module to implement these discount policies. But I'm not sure how this module would interact with the Multiprice module, and I doubt that it can handle different discount amounts (or currencies) for different countries. Any comments on this? Thanks.

    Bartezz’s picture

    Hi,

    Good point about the install schema. Didn't think about that. Best to install the 6.x-2.x-dev version first, than apply patch and then run update. That should work for now. Will look into the schema next week.

    Discounts, good question. Also looked into using the discounts alt module as I think this is the best discount module out there. Yet I don't have the need for fixed amounts, luckily. I'm a 100% positive this will be a problem as I don't think the discount alt module has an option to work with country based discounts. If you want to go this route the it'll probably needs to be developed.

    I mean, yes it will work with uc_multiprice as uc_multiprice changes the node->sell_price but the amount to be subtracted is not country, thus currency, based. So if you add a discount of 15 it will be subtracted of the $100 sell_price for Canada ($85) and it will also be subtracted of the Rp10000 sell_price for India (Rp99985).

    I don't have time or need for this so I would post a feature request in the discounts alt module issue list.

    Will you still let us know how 'the patch worked out for you?

    I'm almost finished with the uc_multiprice_import helper module which allows the import of prices. It won't create any products in the database but update prices for all existing products on a per country or per role base with a delimted file. I'll probably open a new issue for this. And leave this issue for the price per role features.

    Cheers

    Bartezz’s picture

    Category: support » feature

    So back to feature request...

    Oh and it isn´t a dependency but for role prices it is very wise to also install role weights module... as otherwhise role prices are weighted based on the role creation time...

    dfylstra’s picture

    Bartezz, I installed the Role Weights module, set role weights, and installed and enabled the Multiprice module with your changes. (I added the roleid field to the schema, since this was just a few lines a code.) Generally the module is working as expected (great!), but there is one problem, with Product Kits: They seem to ignore role-based prices, though they do recognize country-based prices.

    Under Store administration > Configuration, I now have "Multiprice defaults", "Multiprice currencies" and "Multiprice roles". I didn't change the first two, but I enabled an example role for academic users under "Multiprice roles".

    Now when I edit the Product (logged in as User 1), in the Pricing section I see "Add a price override for a country or role" and below this a dropdown list with first entry "Select country or role" and an explanatory comment "Select the country/region/role to add a price overide." (should be "override"). I can add either a country price override or a role price override, as expected.

    When I log in to an account with the academic user role, I see the role-based academic prices for individual Products, in the catalog, and on the Product pages, as expected. But for Product Kits, I see the sum of the *default prices*, rather than the role-based prices, for the component products, in the catalog and on the Product Kit pages.

    I hope you can fix this, since Product Kits are a fundamental feature of Ubercart, and my site relies extensively on them! If you don't have time to do this, if you can point me to the right place in the code, I will see what I can do. (I have a basic familiarity with Drupal module development, but I've not yet dealt with module development for Ubercart.)

    Here is one more special case: I log in and set the country to the United Kingdom (my default country/currency is United States/USD). I see my UK country prices, with the pound sterling currency symbol. Now I log in to an account with the academic user role, and set the country to the United Kingdom. For individual Products, I now see my role-based (academic) prices, with the dollar currency symbol. But for Product Kits, I see the sum of the default (non-role-based) UK country prices, which are in pounds sterling, but with a dollar currency symbol - not quite right!

    I hope this summary is helpful.

    dfylstra’s picture

    Just FYI, I found a way to implement our price discounts (fixed amounts in each currency) when a customer buys certain combinations of products, using a small enhancement to the UC Discount Framework module (http://drupal.org/project/uc_discount). This module simply defines some Ubercart CA conditions and actions, where the key actions allow you to add a discount line item (which we want) or discount the product prices. Of course you can use the other predefined conditions as well - and a set of "Check products" conditions does just what we want.

    To make this work with Multiprice, I simply had to add one more condition "Check current country" to uc_discount.ca that verifies, at the time the checkout pane is reached, that the session's country ID (determined from the IP address, or selected by the user) is a specific numeric value, like 840 for the US, and 826 for the UK:

    function uc_discount_ca_condition() {
       ...
      $conditions['uc_discount_condition_country_id'] = array(
        '#title' => t('Check the current country'),
        '#description' => t('Current country from IP address or user selection.'),
        '#category' => t('Order'),
        '#callback' => 'uc_discount_condition_country_id',
        '#arguments' => array(
          'order' => array('#entity' => 'uc_order', '#title' => t('Order')),
        ),
      );
      return $conditions;
    }
    
    function uc_discount_condition_country_id_form($form_state, $settings = array()) {
      $form = array();
      $form['country_id'] = array(
        '#type' => 'textfield',
        '#title' => t('Country id'),
        '#default_value' => $_SESSION['country_id'],
        '#description' => t('Country id for which this discount should apply.'),
      );
      return $form;
    }
    
    function uc_discount_condition_country_id($order, $settings) {
        return $settings['country_id'] == $_SESSION['country_id'];
    }
    

    This uses the $_SESSION variable set by Multiprice. With this, I just had to define one predicate for the US, consisting of my conditions for allowing the discount AND Country ID = 840, and another predicate for the UK, consisting of the same conditions for allowing the discount AND Country ID = 826, and so on. I specified a fixed amount for the discount, and this amount appeared with the right currency symbol in the checkout and order summaries, thanks to UC and Multiprice.

    dfylstra’s picture

    A question for Docc or Bartezz: I'm now facing the issue of how to process credit card transactions in multiple currencies. I learned that PayPal Website Payments Pro supports multiple currencies, so I enabled the UC PayPal Payments module, set up a PayPal Website Payments Pro account, and obtained an API key and signature. But when I got to the settings for the PayPal gateway, I found that while there's a dropdown list of many currencies ... you have to select only one currency from this list.

    So now I'm wondering: Can the UC PayPal Payments module, and the PayPal Website Payments Pro gateway, handle a series of transactions in different currencies, or not? Is there some way to dynamically change the Payments module's currency dropdown list selection on each order, or otherwise extend the module to submit transactions in different currencies? Or should I be looking for another credit card gateway / merchant account that will better handle this?

    While it would be best to settle transactions in each currency (USD, GBP and EUR for us), it would probably be OK to translate orders into USD at current exchange rates and settle transactions in USD. I know there are Web services available for exchange rate translation. But how could I implement this in Ubercart? Any suggestions based on experience would be much appreciated. Thanks!

    Bartezz’s picture

    Hey Daniel,

    Thanx for all your feedback. Before start giving some answers or possible solutions I feel I need to tell you that if you have questions that are not directly related to the original post you really need to open a new issue to keep the issue from cluttering up! Also post your questions in the related module's issue queue and if necessary post a link to it here. Not trying to be smart but we have to stay on topic here!

    Alright, product kit problems... I must admit I haven't tested this. Have you tested with product kits before applying the patch? Or are you sure the problems started after applying it? I will test tomorrow and put some work in it. I agree this should work with product kits. Did you take a look here; http://drupal.org/node/669038 Can you check if your version of the module supports kits at all?

    Then, discounts. Thanx for the pointer. Maybe you can create a setting in the original module and post a patch to the uc_discount queue. Looks like it may be helpful to others.

    Paypal... not using it so don't have a real answer to you other then the ones I found in the issue queue, maybe these help;
    http://drupal.org/node/621424
    http://drupal.org/node/512186
    Please submit paypal issues in those threads.

    Cheers

    dfylstra’s picture

    Bartezz -- Point taken, I have actually posted a note about Multiprice and the UC Discount Framework module in that project's issue queue, and I will pursue the PayPal multi-currency problem in the issue queue for that module. Thanks very much for the pointers to those nodes.

    About Product Kits -- They are reflecting the correct prices and currencies in the posted Multiprice 6.x-2.x-dev version, and they're also reflecting the correct prices and currencies for country-specific overrides in the module with your patches applied. The only thing that isn't working is Product Kits when there are role-specific overrides in the underlying Products.

    I think the problem is in uc_multiprice_price_handler_alter(). You have a comment there "if the user has a multiprice enabled role then don't change currency as role based pricing is in default currency" (which is correct), but the code then returns immediately from the function, if the user has such a role. You will see later in the code for this function:

        if ($node->type == "product_kit") { // Product kit
          foreach ($node->products as $product) {
            $field = ($context['field']) ? $product->$context['field'] : $product->sell_price; // check if its there
            $price['price'] += $field + $product->discount;
          }
        ...
    

    and this code is being skipped, so it doesn't accumulate the Product Kit total price from the individual Product prices, in the case of role-based prices.

    I modified the code at the beginning of uc_multiprice_price_handler_alter() to read like this:

      // if the user has a multiprice enabled role then don't change currency
      // as role based pricing is in default currency
      if (array_intersect(array_keys($user_roles), $enabled_roles)) ; // don't change
      else {
        $cid = uc_multiprice_country_id();
        $result = db_query("SELECT * FROM {uc_multiprice_currencies} WHERE country_id = %d", $cid);
        if ($currency = db_fetch_array($result)) {
          $currency['dec'] = $currency['deci'];
          $options = $currency + $options;
          unset($options['deci']);
        }
      }
    

    so now it skips setting the currency, but flows through to set the price for Products and Product Kits. This seems to cure the problem with Product Kits and role-based prices (once I cleared my cache).

    Bartezz’s picture

    Hi Daniel,

    Thanx for the detailed report, that always helps a lot. Sometimes all you get is a "this module doesn't work, please fix".
    Had to dive in there as I haven't worked with product kits. Here's my findings;

    Default store currency: Euro
    Default store country: Netherlands
    Belgium currency: Euro
    Canada currency: CAD
    USA currency: USD

    Product 1
    - default sell price: (€) 2
    - Belgium sell price: (€) 3
    - Canada sell price: ($) 4
    - USA sell price: ($) unset

    Product 2
    - default sell price: (€) 44
    - Belgium sell price: (€) 55
    - Canada sell price: (€) 66
    - USA sell price: (€) unset

    Product kit (combination of product 1 and product 2)
    - total price: empty
    - Product 1 discount: (€2 +) 1.000
    - Product 2 discount: (€44 +) 1.000

    With "Disable unpriced product" and "Fall back to default product price" both disabled
    Displays for Netherlands: Kit price €48
    Displays for Belgium : Kit price €60
    Displays for Canada Kit price $72
    Displays for United States $48

    With "Disable unpriced product" enabled and "Fall back to default product price" disabled
    Displays for Netherlands: Kit price €48
    Displays for Belgium : Kit price €60
    Displays for Canada Kit price -- 'This listing is currently not available.'
    Displays for United States -- 'This listing is currently not available.'

    With "Disable unpriced product" and "Fall back to default product price" both enabled
    Displays for Netherlands: Kit price €48
    Displays for Belgium : Kit price €60
    Displays for Canada Kit price -- 'This listing is currently not available.'
    Displays for United States -- 'This listing is currently not available.'

    This is all without a role enabled, so far so good!

    Now, being silly as I am, I enable role pricing for anonymous users... a whole different ball game :)

    Product 1 added price
    - Anonymous user: (€) 5

    Product 2 add price
    - Anonymous user: (€) 77

    With "Disable unpriced product" and "Fall back to default product price" both disabled
    Displays for Anonymous user with country Netherlands: Kit price €48
    Displays for Anonymous user with country Belgium : Kit price €48
    Displays for Anonymous user with country Canada Kit price €48
    Displays for Anonymous user with country United States €48

    With "Disable unpriced product" enabled and "Fall back to default product price" disabled
    Displays for Anonymous user with country Netherlands: Kit price €48
    Displays for Anonymous user with country Belgium : Kit price €48
    Displays for Anonymous user with country Canada Kit price -- 'This listing is currently not available.'
    Displays for Anonymous user with country United States -- 'This listing is currently not available.'

    With "Disable unpriced product" and "Fall back to default product price" both enabled
    Displays for Anonymous user with country Netherlands: Kit price €48
    Displays for Anonymous user with country Belgium : Kit price €48
    Displays for Anonymous user with country Canada Kit price €48
    Displays for Anonymous user with country United States €48

    So yes, there seems to be some weird stuff going on with product kits and role based pricing.
    Will take a look and see if I can fix this.

    Will be back ;)
    Cheers

    Bartezz’s picture

    Hey Daniel,

    Well I gave it a shot. Please download and install 6.x-2.x-dev (17.68 KB) dated 2010-Nov-12.
    This patch is rerolled against that version.

    I think I've ironed the errors out, will you please check this patch. I've seen this code so much that I might overlooked things.

    Cheers

    dfylstra’s picture

    Bartezz -- In uc_multiprice.install at line 56, I think it should be 'role_id' => array( rather than 'role_id', array(. Otherwise it looks good.

    Here's one more FWIW: I think it's a good idea for the uninstall function to delete variables that the module uses -- though certainly many modules don't do this. In my copy of uc_multiprice.install I added this to uc_multiprice_uninstall():

      $variables = array(
        'uc_currency_code',
        'uc_currency_sign',
        'uc_sign_after_amount',
        'uc_currency_prec',
        'uc_currency_dec',
        'uc_currency_thou',
        'uc_multiprice_default',
        'uc_multiprice_roles',
        'role_weights_reorder_forms',
        'uc_multiprice_roles_fallback',
        'uc_multiprice_currency_disable_unpriced_product'
      );
      foreach ($variables as $variable) {
        variable_del($variable);
      }
    
    Bartezz’s picture

    Hi Daniel,

    My bad... was in a hurry.... so a new patch.
    I agree with you one the variables uninstall but I think you are being to rigorous as you are deleting variables that aren't uc_multiprice's variables. uc_multiprice works with those variables but isn't the 'owner' of them.

    role_weights_reorder_forms is a variable from role_weights.module, uc_currency_*** and uc_sign_after_amount are variables from uc_store.module, all these variables should be unset by uninstalling their corresponding modules.

    More imporatantly, did you test the product kits with the new patch and is everything alright now? If so please change the status to 'reviewed and tested...' so Docc can commit :)

    Cheers

    Bartezz’s picture

    Crap... had a drupal_set_message in there for debugging.... removed it and created a new patch...
    Let's frigging hope this one does the job ;)

    Cheers

    stefan81’s picture

    Hey, great to see that this module is developing :)
    Question, will all the points in the original post be solved when you're finished?

  • Multiprice i18n/language support
  • Multiprice import
  • Multiprice role support
  • Multiprice currencies

    If yes, I would like to make a donation to the developers to thank for your efforts.
    And, of course, I would love to use the module ;)

  • Bartezz’s picture

    Hi Stefan,

    Thanx for the kind words :) All points will be solved, yet for i18n synching you will need Firewing1's module mentioned in OP.

    The import functionality is something Docc still needs to think about if he want's to implement this. I'm almost done with that. This is the last point to be solved. It's a 3 step import form;

    Step 1
    - select csv file
    - select delimiter
    - select field enclosure

    Step 2
    - map column values to ubercart/multiprice values (sku, list_price, cost, sell_price)
    - select country/role for which the import file should update prices
    - select if csv has a header or not
    - start import

    Step 3
    - batch starts going thru all nodes and updates prices

    The others have been solved with the patch in #27. Testers wanted so next to your donation you could also help by testing the patch :)

    Cheers,
    Bartezz

    stefan81’s picture

    Bartezz, I'll test the patch a.s.p and give you a feedback.

    From my point of view, import/export functionality is almost a must, if one wants to run a shop efficiently.
    Please implement it. If you or Docc want to keep the core module lean, why not as submodule?

    A bit off topic, have a look at this brainstorming (link has latest screenshot)
    http://drupal.org/node/564244#comment-2014620
    This automatically calculates the prices of the other countries. I liked the idea.
    Specially if it could be used with bulk operations to recalculate all prices of selected/all products.
    Could be in addition or as alternative to the mport/export functionality.
    Please write your comment on the idea at thread above, if you like.

    Bartezz’s picture

    Stefan,

    Same here. The shop I'm currently working on will eventually have 1000+ products. Prices are in Euro defined by head quarters for all countries except for countries with distributors. Distributors may have different pricing although the shop is maintained by head quarters. Our idea was to have head quarters send out an csv file to all distributors. The distributors could then easily recalculate prices, even create their own Excel macro for recalculation purposes and send the csv back to head quarters for them to upload the csv and update prices. If head quarters has to change prices of each product by hand for let's say 10 distributors next to their own price updates that's 11x1000=11.000 nodes to update... no fun for anyone!

    Off topic, haven't done much with dynamic prices. Ofcourse I looked at them but have no current need for them. To write a bulk operation shouldn't be too hard but I currently don't have time for it. Don't know if you know anything about php but ofcourse you could give it a shot yourself. This looks like a good example to start off with; http://drupal.org/files/issues/auto_nodetitle_360359.patch

    Will work on the import functionality again next tuesday. Hopefully you'll be able to report on the patch by then.

    Cheers

    stefan81’s picture

    question: is the patch to be applied on the 6.x-1.0 or 6.x-2.x-dev release?

    dfylstra’s picture

    Status: Needs review » Reviewed & tested by the community

    Bartezz -- Thanks for pointing out my overzealousness with the variable_del() calls for variables not controlled by the Multiprice module. I've backed out those extra variables from my copy of the multiprice.install file.

    I've downloaded and applied your latest patch file, and checked that the files match the versions I am using on my site. And yes, it all seems to be working for me, for both country-based prices and role-based prices. I've set the status to reviewed and tested.

    I really appreciate being able to use this enhanced version, and was glad to make my small contribution!

    dfylstra’s picture

    The patch file applies to the 6.x-2.x-dev release.

    stefan81’s picture

    Thanks!
    First impression:

  • the js conflicts with "jQuery Update 6.x-2.0-alpha1". On node edit, new overrides are not added.
  • Option to fully disable the "Multiprice Roles" functionality. Either on the "Multiprice Roles" admin pane, or better, as submodule on the modules admin page.
  • "Multiprice roles fallback" Make a radio button for better understanding: "Fall back to default product price" / "Fall back to country based pricing"
  • Rest works well so far!
  • stefan81’s picture

    nice to have:
    themable form output like in core (uc_product.module - line 574):

    function theme_uc_product_form_prices($form) {
      return "<table><tr><td>\n". drupal_render($form['list_price'])
        .'</td><td>'. drupal_render($form['cost'])
        .'</td><td>'. drupal_render($form['sell_price'])
        ."</td></tr></table>\n". drupal_render($form);
    }
    

    or add classes hardcoded in the module ?

    because I would like to add a class to the price table fields on the product edit page:

    <td class="list-price"><div class="form-item" id="edit-multiprice-multiprices-0-list-price-wrapper">
     ...
    <td class="cost"><div class="form-item" id="edit-multiprice-multiprices-0-cost-wrapper">
    ...
    <td class="sell-price"><div class="form-item" id="edit-multiprice-multiprices-0-sell-price-wrapper">
    
    Bartezz’s picture

    Hi guys,

    Thanx for posting back. As to your pointers Stefan;

    - Have to check what version of jQuery Update I'm running on tuesday, haven't had issues with my version. Ofcourse you are using an Alpha. That might be the problem... Don't use Alphas in working versions :) Hence the name Alpha!
    - Tried to make it a submodule but there's no way to do this unfortunately. You don't have to disable roll functionality, just don't enable any roles and you'll be fine :)
    - The radio is an option I'll have to think about. The description states exactly what the checkbox does, not reading a description in any module is a user's own problem. Without checking the box the module works as expected -> country based prices. If you don't want that, check the box, and it'll fall back to default prices. So I'll think about it, but the probable answer is I'll leave it a checkbox.

    What output do you want themable? The only output that isn't themed I think is the message 'Listing currently not available'. I think this needs to be themable. Other output isn't themed by the module afaik...

    Cheers

    stefan81’s picture

    Ok, thank you.

    I found it: theme_uc_multiprice_form here I can theme the table.
    Because I have a case where I need to hide "list-price" and "cost".

    neat work!

    Bartezz’s picture

    Title: Extending Multiprice module » Extending Multiprice module: 18n support / role support / currency fixes

    To prevent even more clutter in this issue I've started a new issue where I posted a patch with import/update functionality for uc_multiprice module http://drupal.org/node/991352

    Cheers

    Docc’s picture

    Looking good Bartezz. I will have some spare time this weekend so i can test and commit.

    Bartezz’s picture

    @Stefan, no issues with jQuery update 6.x-1.1, so I reckon the version you are using still is buggy!

    @Docc, thanx. It's my biggest patch untill now I reckon, hope you like it :)

    Cheers

    Docc’s picture

    Awsome Bartezz. Tnx for the help. Commited to dev.
    A stable release will follow soon.

    Bartezz’s picture

    Status: Reviewed & tested by the community » Closed (fixed)

    Cool! Thanx for comitting!!

    Maybe you have time to look at the import/update helper module I've written; http://drupal.org/node/991352

    Cheers

    lpalgarvio’s picture

    subscribe