Jump to content

Recommended Posts

@@wHiTeHaT,

 

Thank You!!

 

I wonder if it wouldn't be easier in THAT concrete case just to modify the core shopping_cart class. :)

Edited by raiwa

Share this post


Link to post
Share on other sites

@@wHiTeHaT,

 

this part solved most:

        public $contents;
        public $total;
        public $weight;
        public $cartID;
        public $content_type;
        public $product_id_list;      
        public $customer_id;
        
        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 can place now:

      		$cart = new shoppingCartMod();

into a header tag execute function and it works.

 

But still an issue:

If I move the extension class:

require(DIR_WS_CLASSES . 'shopping_cart_mod.php');

below section :

"// start the session"

in application_top.php

(OK, its just to localize the problem, I finally wish to move the class extension into the header tag module .)

 

I loose the shopping cart content each time when I leave the shopping cart page (with logged in customer)

I checked the session and content gets empty:

cart|O:15:"shoppingCartMod":7:{s:8:"contents";a:0:{}s:5:"total";i:0;.................

So I tried something with session register, but no success.

Is this what you mean with "//Here you could update the $cart data" or is it a different session related problem??

 

Thank You!!

 

PS: All help request is not for my personal purpose, but will be offered to the comunity in form of a free add-on :)

I do not need this for my store or any commercial job.
 

Edited by raiwa

Share this post


Link to post
Share on other sites
I also must be hornest, the current way and attempts is like carry water to the sea.

As long as there is no products class it will be a hell to manipulate products prices for the whole shop.

 

Thats not my intention, I show only on product_info the wholesale price in a content module in addition to the normal price. Then in shopping cart I apply the wholesale price if conditions apply and apply it to the order via shopping cart class manipulation.

 

 

$cart = new shoppingCartMod();

$cart variable is connected to the shoppingCart() class.

you cannot assign 1 var to two classes and expect magic.

 

Works for me in another addon (show tax below price) and with a currency class extension without problems. But ok the session issue makes it different here it seems.

Remember, I do not intend to manipulate via additional function like in your example, I only intend to change the price and total calculation in the calculate and get_products function.

 

I do not need this:

$cartMod->set_quantity($products[$i]['id'])

 

I only wants a different result for the standard:

$cart->get_products()

and

$cart->show_total()

 

 

Thank you

Share this post


Link to post
Share on other sites

@@greasemonkey, @@burt, @@wHiTeHaT, @@Gergely,

 

A beta version of my Wholesale (SPPC light) if you wish to give it a try.

2 versions included:

- Wholesale price only in product info via content module.

- All prices modified via currency class extension based on Gergely's dev.

 

See short instructions included.

 

 

 

Share this post


Link to post
Share on other sites

Some additional thoughts:
 
- optional percentage wholesale discount applies to all products except products which have an individual wholesale price asigned.
  This could be interesting for stores which already have a lot of products and add the wholesale add-on.
- Specials check: if special price is < wholesale price, special price will be used as wholesale price:
 
In product info module:

        	$product_info_ws_query = tep_db_query("select p.products_tax_class_id, p.products_ws_price,
        						IF(s.status and s.specials_new_products_price < p.products_ws_price, s.specials_new_products_price, NULL) as products_ws_price, 
        						p.products_id from products p
        						left join specials s on s.products_id = " . (int)$_GET['products_id'] . " 
        						where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "'");

In st_wholesale.php module (within  class currencies_modwhs extends currencies_mod) :

              $ws_price_query = tep_db_query("select p.products_tax_class_id, p.products_ws_price,
        				             IF(s.status and s.specials_new_products_price < p.products_ws_price, s.specials_new_products_price, NULL) as products_ws_price, 
        					     p.products_id from products p
        					     left join specials s on s.products_id = " . (int)$products_id . " 
        					     where p.products_status = '1' and p.products_id = '" . (int)$products_id . "'");

In shopping_cart_mod class:
 
within       public function calculate() {
 

$products_price = $product['products_ws_price'] < $specials['specials_new_products_price']? $product['products_ws_price'] : $specials['specials_new_products_price'];

 
within     public function get_products() {
 

$products_price = $products['products_ws_price'] < $specials['specials_new_products_price']? $products['products_ws_price'] : $specials['specials_new_products_price'];

Note:

the language definitions for admin categories.php and admin customers.php are included as config entries in the store_wholesale module. This is not standard and it maybe better to add the definition in the classic way to the language files until admin will be modular and/or language definitions moved to the database.

Edited by raiwa

Share this post


Link to post
Share on other sites

@@raiwa

 

You have some good thoughts going into this and I commend you for working on this.  I should be able to help with testing next week.


I'm not really a dog.

Share this post


Link to post
Share on other sites

Here Wholesale (SPPC light) beta 02:

 

Changes:

- removed currency class extension. special prices can't be solved without changes in all files where prices are shown. Gergely pointed this out in his thread.

 So in order to keep this SPPC version simple, I decided to show only wholesale prices in product_info via content module.

- added optional global percentage discount

- added optional use of special price if < wholesale price.

- fixed wholesale gross price calculation script in admin/categories.php

 

To do, to decide, to discuss:

- Add attributes wholesale price??

- Add wholesale price to product_listing module?? (I suggest to show it additional to normal price)

 

Please discard all files from previous version.

Edited by raiwa

Share this post


Link to post
Share on other sites

what about wholesale login and go another direction? I suggest wholesale_index.php wholesale_products_info.php and so on. It could be a specialized way.


:blink:
osCommerce based shop owner with minimal design and focused on background works. When the less is more.
Email managment with tracking pixel, package managment for shipping, stock management, warehouse managment with bar code reader, parcel shops management on 3000 pickup points without local store.

Share this post


Link to post
Share on other sites

what about wholesale login and go another direction? I suggest wholesale_index.php wholesale_products_info.php and so on. It could be a specialized way.

 

How to redirect?? changing the filename definitions?? Wasn't they planned to be hardcoded in future. THis way seems to me to finish in a almost complete second set of files. What then with other customizations done in these files?? It sounds me to go to all problems of my old iosc mobile :)

Share this post


Link to post
Share on other sites

@@raiwa

 

As this addons name suggests, keep it simple. Its only the lite version, which I think is great. Sometimes its not necessary to have all the bells and whistles.

 

Keep up the good work.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

Wholesale (SPPC light) beta 03:

 

Changes:

- Added wholesale options value price.

- Update instructions from beta 01+02 added

 

Cons: Admin/product_attributes.php and catalog/product_info.php need modifications.

Share this post


Link to post
Share on other sites

Pre-Release version Wholesale (SPPC lite) 1.0:

 

Changes:

- Fix for special price logic

- Fix for wholesale price logic (for wholesalers logged in apply normal price if no wholesale price defined)

- Versions for 2.3.4 standard added

- Full Instructions added

 

Features:

  • Posibility to asign customers to the wholesaler group
  • Define individual wholesale prices to each product
  • Optional define individual wholesale prices to attributes
  • Optional define global wholesale percentage discount to all products and attribute prices
    The global wholesale discount will not apply to products and attributes which have individual wholesale prices defined
  • Optional setting to apply special price instead of wholesale price if the special price is lower than the wholesale price or discount.
  • Header text module to show different info text for guests, retailers and wholesalers. The texts are editable for each store language in the module settings.
    By default:
    Guests: no text
    Retailers: “Welcome to your Retailer Account.<br>Please <a class="btn btn-info btn-xs" role="button" href="contact_us.php">Contact Us</a> to apply for a Wholesaler Account. See <a class="btn btn-info btn-xs" role="button" href="conditions.php">Conditions</a>.”
    Wholesalers: “Welcome to your Wholesaler Account.<br>You can see your Wholesaler Prices on the Product Page and they will apply when you add the products of your choice to the Shopping Cart.”
  • Product Info Content module to show the wholesaler price in addition to the normal price on the Product Info Page
  • Only 2 Store file modifications. application_top.php one line added. Optional product_info.php attribute block modified to show wholesale attribute price.
  • 3 admin files modified, categories.php, customers.php and product_attributes.php.
  • Modified files for 2.3.4 standard, Bootstrap Gold and Bootstrap Edge included.
  • The wholesale prices will be automatic applied when adding a product to the Shopping Cart. This is done via shopping cart class extension, no file modification needed.
  • All database modifications and language definitions are integrated in the modules.
  • Optional database columns removal to keep existing entances when removing the module

Thanks

  • To @@greasemonkey for the initial idea, support, comments and testing
  • To @@burt for the initial guideline exposed in the forum and his database installation-removing code examples used in the store module
  • To @@wHiTeHaT for his help with the shopping cart class extension
  • To @@Gergely, @@John W and @@14steve14 for their support, comments and testing

Please give it a try and test. I'll wait around one week before upload.

 

 

Share this post


Link to post
Share on other sites

There is still an issue for the special price logic in shopping cart, I'll try to fix it and upload the update during today. Only shopping_cart class extension involved.

Share this post


Link to post
Share on other sites

Please use this version.

Changes:

- Special price logic fixed in shopping cart mod class

 

Update replace: includes/classes/shopping_cart_mod.php

 

 

Share this post


Link to post
Share on other sites

Hi raiwa,

 

I wanted to try it in a new install and founnd that

ALTER TABLE `customers` ADD `customers_wholesale` CHAR(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL ;
ALTER TABLE `products` ADD `products_ws_price` DECIMAL(15,4) NOT NULL AFTER `products_price`;


are missing in the Install_Wholesale.docx

 

Thanks for your work :thumbsup:


Get the latest Responsive osCommerce CE (community edition) here .

(Live   : OsC 2.2, php 5.4 & UTF-8  |  Local : OsC 234BS php7.2 Edge for future shop)

Share this post


Link to post
Share on other sites

Hello Fred @@bonbec,

 

The database modifications are automatic applied when installing the store module. No manual query need to be executed. :)

 

st_wholesale.php:

      if (tep_db_num_rows(tep_db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='". DB_DATABASE . "' AND TABLE_NAME='customers' AND COLUMN_NAME LIKE 'customers_wholesale'")) != 1 ) {
      tep_db_query("alter table customers add column `customers_wholesale` CHAR(1) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL");
      }
      if (tep_db_num_rows(tep_db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='". DB_DATABASE . "' AND TABLE_NAME='products' AND COLUMN_NAME LIKE 'products_ws_price'")) != 1 ) {
      tep_db_query("alter table products add column `products_ws_price` DECIMAL(15,4) NOT NULL AFTER products_price");
      }
      if (tep_db_num_rows(tep_db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='". DB_DATABASE . "' AND TABLE_NAME='products_attributes' AND COLUMN_NAME LIKE 'options_values_ws_price'")) != 1 ) {
      tep_db_query("alter table products_attributes add column `options_values_ws_price` DECIMAL(15,4) NOT NULL AFTER options_values_price");
      }
Edited by raiwa

Share this post


Link to post
Share on other sites

Hello Rainer,

 

Yes, I see it after my message but I have a problem.

 

I download the Edge version of 234BS. In the fresh install, I made a french translation. After that, as it's a fresh install, I copy all the files (New files and 2.3.4._BS_EDGE for the modified files) and add french translation (and inside the file st_whosale.php in the switch ($key) like ESPAGNOL, GERMAN ...).

Then, I have "1054 - Unknown column 'customers_wholesale' in 'field list'
select customers_wholesale from customers where customers_id = '0'
" and I wrote my message last day.

 

Today, I tell me that that could be a mistake with my translation, so I erase all the scripts and all my mysql tables and I do a new install but only in english. I don't add any translation.

I copy all the files (New files and 2.3.4._BS_EDGE for the modified files) and launch the site ...

The same errors become in the customers side.

 

In the admin side, last day and today, I can do that :

Admin => modules => content => [product_info] Product Page Wholesale Price
Admin => modules => content => [header] Wholesale Message

But can't do that because store is not here.

Admin => modules => store => wholesale

This is why I have the errors.

I am in local (uWamp in windows with php 5.6.12 and mysql-5.5.9).

 


Get the latest Responsive osCommerce CE (community edition) here .

(Live   : OsC 2.2, php 5.4 & UTF-8  |  Local : OsC 234BS php7.2 Edge for future shop)

Share this post


Link to post
Share on other sites

@@bonbec,
 
You need to copy:

From: New files/2.3.4._BS/
[catalog ]/[admin]/includes/languages/english/modules/cfg_modules/cfgm_store.php
[catalog ]/[admin]/includes/modules/cfg_modules/cfgm_store.php

Then you should find in:
Admin => modules => store => wholesale

Edited by raiwa

Share this post


Link to post
Share on other sites

Hello Rainer,

 

This is this file I forgot the two times to copy :

[catalog ]/[admin]/includes/modules/cfg_modules/cfgm_store.php

 

Thanks !

I can thoroughly test, thank you again!


Get the latest Responsive osCommerce CE (community edition) here .

(Live   : OsC 2.2, php 5.4 & UTF-8  |  Local : OsC 234BS php7.2 Edge for future shop)

Share this post


Link to post
Share on other sites

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

 

Shall I wait a bit more? 5 downloads no feedback yet. (I know, you are all very busy :) )

 

Thank you

Rainer

Share this post


Link to post
Share on other sites

@@raiwa

I just DL'd your latest zip, but it will be later this week before I can test much.  First, on my stock test shop, then my main test shop.  My goal is to replace the sppc I've been using for years.  My live shop is still somewhat Frankensteined. 


I'm not really a dog.

Share this post


Link to post
Share on other sites

@@raiwa

I added all the files and modified files, but store is not showing up under modules. 

Admin => modules => store => wholesale


I'm not really a dog.

Share this post


Link to post
Share on other sites

@@John W,

 

You need to copy:

From: New files/2.3.4._BS/
[catalog ]/[admin]/includes/languages/english/modules/cfg_modules/cfgm_store.php
[catalog ]/[admin]/includes/modules/cfg_modules/cfgm_store.php

Then you should find in:
Admin => modules => store => wholesale

Share this post


Link to post
Share on other sites

Actually, I see what's wrong.  You're missing the includes on the admin side. 


I'm not really a dog.

Share this post


Link to post
Share on other sites

I used beyond compare to move them over and didn't realize at first they went into the wrong folder.  You need to add includes on your zip.


I'm not really a dog.

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

×