Jump to content

Recommended Posts

I really like how simple this is to install and the files that are modified are much less and much easier that regular sppc.  Like Burt said about SPPC, many of the versions have complications that few people use. 

 

The only that sticks out to me is the wholesale price should replace the price on the page or strick it out like on special mabye.  But I think it should be where the price is.  Customers miss all kinds of stuff when it's right in front of there face. 

 

There are some little things I would modify but I think it's maybe more personal preference.  I don't have wholesale pricing on everything.  One thing is reality is new signups that would qualify just go look and buy, so I try to keep my pricing at a best level.  But, I'm selling a niche product so my thoughts may not apply to most.


I'm not really a dog.

Share this post


Link to post
Share on other sites

@@John W,

 

Thank you, I'll fix it and will have a look and thoughts about your other suggestions.

 

regards

Rainer

Share this post


Link to post
Share on other sites

@@raiwa

It's good work.  Another thought I have is for someone to be wholesale normally means tax exempt also (at least in the states).  I only collect tax in Florida, but anyone in FL I have to have there resale tax id number.  The main SSPC collects that in the signup with an email notifying the store owner. 


I'm not really a dog.

Share this post


Link to post
Share on other sites

@@John W and other testers,
 
Here version 1.1 updated with John's fixes and suggestions:
 
- missing includes/ added to admin/store module
- added wholesalers tax exempt option to store module. No core changes, all changes in shopping_cart extension class and product info module
- product info module modified (product_info_price) to be placed under the standard price. Additional minor mod in product_info.php. No other way until product info will be modularized.
 
- the mentioned tax number integration in create account has been left out. It is not required for the wholesale functionality and would mean many additional core modifications. There are some add-ons already available which do this who needs it:
http://addons.oscommerce.com/info/1848
http://addons.oscommerce.com/info/1590
http://addons.oscommerce.com/info/8971
http://addons.oscommerce.com/info/1180
and some older add-ons.
There may be also many stores which manage the invoicing in an external way and keep there the tax number information. Wholesalers in any way need to contact and apply for wholesale account.
 
Your thoughts??

 

 
Update from version 1.0:

- replace:

[catalog ]/includes/classes/shopping_cart_mod.php

- uninstall product_info and store module

- replace:
[catalog ]/includes/modules/store/st_wholesale.php
[catalog ]/product_info.php or apply Step 5a of the install instructions

- upload:
[catalog ]/includes/languages/english/modules/content/product_info_price/cm_pi_ws_price_pr.php
[catalog ]/includes/modules/content/product_info_price/cm_pi_ws_price_pr.php
[catalog ]/includes/modules/content/product_info_price/templates/ws_price.php

 

- install product_info_price and store module

 

Thanks for testing

Rainer

Share this post


Link to post
Share on other sites

@greasemonkey, @Gergely, @John W, @Tsimi, @wHiTeHaT, @burt, @bonbec, @14steve14,

 

I'm working on a (last) feature to add to wholesale SPPC lite:

 

optional exclude shipping and payment modules, separate for wholesalers and retailers.

(integrated in st_wholesale modules, only 2 lines to add to checkout_shipping.php and checkout_payment.php)

 

Does it make sense, is it needed, is it already "overengineered" for this lite version??

 

Please any feedback is very welcome.

 

regards

Rainer

Share this post


Link to post
Share on other sites

I never implemented that part of SPPC, but I do have a couple customers that I enable "terms" for.  I just switch it on and off as needed. 


I'm not really a dog.

Share this post


Link to post
Share on other sites

[...]

              
        public function __construct() { 
            global $cart, $customer_id;
            $this->contents = $cart->contents;
            $this->total = $cart->total;
            $this->weight = $cart->weight;
            $this->cartID = $cart->cartID;
            $this->content_type = $cart->content_type;
            $this->product_id_list = $cart->product_id_list;
        }        
[...]

 

 

I think you can improve this code mantaining data coherence between original $cart and your shoppingCartMod variables using references:

public function __construct() { 
    global $cart, $customer_id;
    $this->contents = &$cart->contents;
    $this->total = &$cart->total;
    $this->weight = &$cart->weight;
    $this->cartID = &$cart->cartID;
    $this->content_type = &$cart->content_type;
    $this->product_id_list = &$cart->product_id_list;
}

You can think that it does not matter, because all $cart uses refers to you $shoppingCartMod instance: you control the system. But two replies:

  • Another extension can take pararell control, out of your controll
  • You save RAM. I'm not an expert on PHP memory management, I come from Java, where references are very useful to save memory.

I have not tested it in your module, I have tested it in my order extension (inspired by you ;) ) and it works with these benefits.

Edited by katapofatico

Share this post


Link to post
Share on other sites

Last version 1.2 before Add-On release:
 
Changes:
- Optional payment and shipping modules Exclusion lists for Wholesalers and Retailers.
 
Update from version 1.1:
 
1. Upload new classes:
[catalog ]/includes/classes/payment_wholesale_mod.php
[catalog ]/includes/classes/shipping_wholesale_mod.php
2. Uninstall: Admin => modules => store => wholesale
3. Upload and replace:
- [catalog ]/includes/modules/store/st_wholesale.php
4. Upload and replace modified files:
- [catalog ]/checkout_shipping.php
- [catalog ]/checkout_payment.php
OR
apply modifications Install doc Step 5+6
6. Install: Admin => modules => store => wholesale

 

Please test and report

 

Thank You

 

 

Share this post


Link to post
Share on other sites

Hopefully definite version 1.3

 

I had to modify shipping and payment module exclusion:

- the modification would need additional changes in payment modules like paypal express and others.

- I decided to modify the core payment and shipping class, so it works everywhere with only 2 modifications in core classes.

- if someone could find another solution: inlcude shipping and payment class extension which modifies the shown modules into the st_wholesale module, it would be very appreciated.

- comment for classes modification added to st_wholesale module

 

Update from version 1.2:

. Upload modified classes:
[catalog ]/includes/classes/payment.php
[catalog ]/includes/classes/shipping.php

OR
apply modifications Install doc Step 5+6
2. Uninstall: Admin => modules => store => wholesale
3. Upload and replace:
- [catalog ]/includes/modules/store/st_wholesale.php
4. Revert modifications in files:
- [catalog ]/checkout_shipping.php
- [catalog ]/checkout_payment.php

5. Remove classes:
[catalog ]/includes/classes/payment_wholesale_mod.php
[catalog ]/includes/classes/shipping_wholesale_mod.php
6. Install: Admin => modules => store => wholesale

 

Thanks for your patience

 

Rainer

 

Share this post


Link to post
Share on other sites

@@raiwa

 

Hi Rainer

 

I downloaded your latest package (v1.3). First, I have never used any Addon like this and I don't use any wholesale function in my shop so I might ask "stupid" questions that are obvious for some that use a wholesale feature.

I installed the addon by following the install manual just to see if the FIND and REPLACE or ADD BELOW stuff is correct and it all seems to be fine.

There are two small typos in the "Optional" Section of the install manual. (../classes/shipping.php and ../classes/payment.php)

Optional changes need following fix.

../classes/shipping.php

FIND
 

          $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
        }
      }
    }

REPLACE WITH
 

          $GLOBALS[$include_modules[$i]['class']] = new $include_modules[$i]['class'];
        }
    //}  // wholesale (SPPC Lite)
    }

../classes/payment.php

FIND
 

          $this->form_action_url = $GLOBALS[$module]->form_action_url;
        }
      }
    }

REPLACE WITH

          $this->form_action_url = $GLOBALS[$module]->form_action_url;
        }
    //}  // wholesale (SPPC Lite)
    }

This SPPC Lite thing is doing what exactly? I can assign a customer as Retailer or Wholesaler?

What if I have Customer A, Customer B and Customer C.

 

Customer A = Normal customer / Retailer?

Customer B = Wholesaler / 10% off on all prices.

Customer C = Wholesaler / 25% off on all prices.

 

Would such scenario be possible? Or can I only assign a customer to 1 wholesale group with one wholesale price reduction? Make sense?

Sorry to ask such complicate stuff but I used to have access to a wholesaler long time ago and there each customer had different prices depending on the deal they made.

I had 50% off on products, other customer had only 35% off and another guy had 55% off on stuff. So individual prices or price reductions per customer.

 

I didn't complete the order process just tested until order confirmation page. The shipping and payment exclusion works fine after adding the above fixes. I can't test the e-mail function since I have this installed in a local shop (XAMPP) without e-mail features.

Edited by Tsimi

Share this post


Link to post
Share on other sites

Hello lambros @@Tsimi,

 

Thank you very much for testing.

 

I'll apply the fix and I think I'll upload it then to the add-ons.

 

Yes, there is only one additional wholesaler group. It is suposed to be enough for most stores. Those who need more groups and more features can still use the old SPPC add-on.

 

Thanks again

Rainer

Share this post


Link to post
Share on other sites

@@Tsimi,

 

Forgot to mention that there ia a great e-mail tool for local test environments recomended by Harald:

http://forums.oscommerce.com/topic/398393-windows-and-php-email-catcher-for-developers/?hl=papercut

 

I use it with XAMPP and it's easy to install and configure and works very well.

 

Rainer

Share this post


Link to post
Share on other sites

@@Tsimi,

 

I double checked your fixes and found that there is all correct in my modified classes and the instructions in version 1.3.

You might have mixed up something with the changes of the shipping_wholesale_mod.php and paymentshipping_wholesale_mod.php classes of the previous version 1.2??

Share this post


Link to post
Share on other sites

@@raiwa

 

Hi Rainer

 

I have all the files at the office and I am at home already. Will double check tomorrow again.

And thanks for the link to that e-mail tool will install it tomorrow.  :thumbsup: 

Share this post


Link to post
Share on other sites

Add-on uploaded:

http://addons.oscommerce.com/info/9416

 

@@Tsimi,

 

Yes, I found now some fault in the shipping and payment class mod.

But there are also changes needed in the upper parts:

payment.php:

      if (defined('MODULE_PAYMENT_INSTALLED') && tep_not_null(MODULE_PAYMENT_INSTALLED)) {
      	// wholesale (SPPC Lite) BEGIN
    		if ( defined(MODULE_STORE_WHOLESALE_STATUS) && MODULE_STORE_WHOLESALE_STATUS == 'True' ) {
    			$check_customer_query = tep_db_query("select customers_wholesale from customers where customers_id = '" . (int)$customer_id . "'");
    			$check_customer = tep_db_fetch_array($check_customer_query);
    			$temp_payment_array = null;
    			if (tep_session_is_registered('customer_id') && $check_customer['customers_wholesale'] == '1' && tep_not_null(MODULE_STORE_WHOLESALE_WHOLESALER_PAYMENT_MODULES)) {

shipping.php:

      if (defined('MODULE_SHIPPING_INSTALLED') && tep_not_null(MODULE_SHIPPING_INSTALLED)) {
      	// wholesale (SPPC Lite) BEGIN
    		if ( defined(MODULE_STORE_WHOLESALE_STATUS) && MODULE_STORE_WHOLESALE_STATUS == 'True' ) {
    			$check_customer_query = tep_db_query("select customers_wholesale from customers where customers_id = '" . (int)$customer_id . "'");
    			$check_customer = tep_db_fetch_array($check_customer_query);
    			$temp_shipment_array = null;
    			if (tep_session_is_registered('customer_id') && $check_customer['customers_wholesale'] == '1' && tep_not_null(MODULE_STORE_WHOLESALE_WHOLESALER_SHIPPING_MODULES)) {

I also modified the isEnabled functions in the content modules to show them only if the main store module is enabled:

    function isEnabled() {
    	if ( defined(MODULE_STORE_WHOLESALE_STATUS) && MODULE_STORE_WHOLESALE_STATUS == 'True' ) {
    		return $this->enabled;
    	} else {
    		$this->enabled = false;
    	}
    }

And I added a check function to the shopping_cart_mod to be sure it's an actual wholesaler:

  function isWholesaleCustomer() {    	
    global $customer_id;
    
    $check_customer_query = tep_db_query("select customers_wholesale from customers where customers_id = '" . (int)$customer_id . "'");
    $check_customer = tep_db_fetch_array($check_customer_query);
    if (tep_session_is_registered('customer_id') && $check_customer['customers_wholesale'] == 1 ) {
    	return true;
    } else {
    	return false;
    }
   }

It's used now in all other shopping_cart_mod functions. Example:

          if ( tep_session_is_registered('customer_id') && defined(MODULE_STORE_WHOLESALE_STATUS) && MODULE_STORE_WHOLESALE_STATUS == 'True' && isWholesaleCustomer() == true ) {

Without this it was possible to get wholesale prices for retailers if they had a session before with a wholesaler account on the same computer. Also if the account type was changed in Admin during customer session. Not very prob to happen, but who knows.

 

Thanks again for all support and help

Rainer

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

 

Hi Rainer

 

I am back at the office and I checked again. If I use the code for the shipping and payment classes as written in step 5 and 6 (of v1.3) i get this error message.

 

Parse error: syntax error, unexpected '}' in D:\xampp\htdocs\demo14\includes\classes\shipping.php on line 149

 

But it doesn't matter anymore since your code changes in the latest v1.4 fix the issue. So no need to apply any of my fixes above. Well done! :thumbsup:

No I will install the e-mail tool and do some more testing of your new v1.4. :D

Edited by Tsimi

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×