Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Robbee,

Can you tell me where code is located to set the customer database id default that is currently "0" which is the retail---to a number representing wholesale instead.
Actually, there is none. It relies on the fact that the customer_group_id is not set when an account is created and mysql will insert the default value: 0.

 

If you want to put everyone who creates an account in Wholesale, you just need to add something to the code before the information is inserted:

 

      // EOF Separate Pricing Per Customer
     tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

 

If you put somewhere above that:

// add the customer_group_id for wholesale to everyone who creates an account:
      $sql_data_array['customers_group_id'] = '1';

You understand I suppose here that the id for wholesale is 1.

 

I want everyone to see the retail, BUT for everyone who creates an account I would like everyone to automatically be Wholesale.

The "retail" customers can checkout without an account for the retail prices and everyone else just by virtue of "creating an account" gets to be wholesale Automatically without my approval, so they can order that same day without waiting.

 

This is not obvious to me.

For me neither because if you use PWA an account is still created and I assume it uses the very same page to gather the info from the customer...
Link to comment
Share on other sites

I love the contribution, I ahve it on a site that also has multi stores contribution installed. It hides the prices but when a wholesalers logins it shows the retail price instead of the whole sale price.

"There is no disgrace in not knowing, the only disgrace is not to be willing to learn." ...Benjamin Franklin

Link to comment
Share on other sites

I love the contribution, I ahve it on a site that also has multi stores contribution installed.  It hides the prices but when a wholesalers logins it shows the retail price instead of the whole sale price.

So obviously something goes wrong. Is the price wrong on all the pages, just on one page? Does it go wrong on the login part?

 

You could check if the customer_group_id is set correctly when logging-in by adding on some page (for example the index page) a little bit of code:

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); 
echo '<pre>';
print_r($_SESSION);
?>

If you don't want everybody to see it, you might even add HTML comment tags around it, so you only see it in the page source:

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); 
echo '<!-- <pre>';
print_r($_SESSION);
echo '</pre> -->';

 

You should see (among other things) something like this:

 

    [sppc_customer_group_id] => 1
   [sppc_customer_group_show_tax] => 1
   [sppc_customer_group_tax_exempt] => 0
   [customer_country_id] => 223
   [customer_zone_id] => 18

Link to comment
Share on other sites

Hello! I've installed this contribution which is working perfectly apart from a few problems i've had with it working alongside a contribution which adds a new column in the product listings..

 

 

The problem is only within this one file:

 

catalog\includes\modules\product_listing.php

 

There are only 2 updates that SPPC needs in this file.. but doing them breaks the other contribution...

 

 

The second change tells me to replace some old code with this code:

 

 

 

**WITH**

$lc_text = ' ' . $listing[$x]['products_model'] . ' ';
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_NAME':
? ? ? ? ? ?$lc_align = '';
? ? ? ? ? ?if (isset($HTTP_GET_VARS['manufacturers_id'])) {
? ? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>';
? ? ? ? ? ?} else {
? ? ? ? ? ? ?$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a> ';
? ? ? ? ? ?}
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_MANUFACTURER':
? ? ? ? ? ?$lc_align = '';
? ? ? ? ? ?$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a> ';
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_PRICE':
? ? ? ? ? ?$lc_align = 'right';

? ? ? ? ? ?if (tep_not_null($listing[$x]['specials_new_products_price'])) {
? ? ? ? ? ? ?$lc_text = ' <s>' . ?$currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span> ';
? ? ? ? ? ?} else {
? ? ? ? ? ? ?$lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' ';
? ? ? ? ? ?}
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_QUANTITY':
? ? ? ? ? ?$lc_align = 'right';
? ? ? ? ? ?$lc_text = ' ' . $listing[$x]['products_quantity'] . ' ';
? ? ? ? ? ?break;
case 'PRODUCT_LIST_INFO':
? ? ? ? ? ?$lc_align = '';
? ? ? ? ? ?$lc_text = $listing['products_info'] . ' ';
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_WEIGHT':
? ? ? ? ? ?$lc_align = 'right';
? ? ? ? ? ?$lc_text = ' ' . $listing[$x]['products_weight'] . ' ';
? ? ? ? ? ?break;
? ? ? ? ?case 'PRODUCT_LIST_IMAGE':
? ? ? ? ? ?$lc_align = 'center';
? ? ? ? ? ?if (isset($HTTP_GET_VARS['manufacturers_id'])) {
? ? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
? ? ? ? ? ?} else {
? ? ? ? ? ? ?$lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
? ? ? ? ? ?}
? ? ? ? ? ?break; // EOF Separate Pricing per Customer
? ? ? ? ?case 'PRODUCT_LIST_BUY_NOW':
? ? ? ? ? ?$lc_align = 'center';
? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

 

 

 

The following bit of code i need to put back in, but when i do now it doesn't work..

does anyone know what i need to change the following to so that it works?

 

 

 

/// kev clip ?start
case 'PRODUCT_LIST_URL':
? ? ? ? ? ? $lc_align = 'center';
? ? ? ? ?if( (tep_not_null($product_clip['url']))) {? ? ? $lc_text = '<a href="play_real.php?product_id=' . $listing['products_id'] . '">' . tep_image_button('preview_mp3.gif', IMAGE_BUTTON_MP3) . '</a>';
? ? ? ? ?} else {
? ? ? $lc_text = '-';
? ? ? ? ?}
? ? ? ? ? ?break; ? ? ? ? 
/// kev clip ? end

 

i think the problem is the "IF" part... as my site is always executing the "else" part of this... does anyone know how to reformat it as this part below is.. which i think i also need to do:

 

i also believe i need to change this: $listing['products_id'] to this:

$listing[$x]['products_id']

 

i also have this code which calls the data earlier on that i might need to change too:

 

// kev clip start  
$product_clip['url'] = tep_get_urlclip($listing[$x]['products_id']);
//kev clip end

 

if anyone could help it would be much appreciated.....

thanks in advance :)

kev.

Edited by kev@num
Link to comment
Share on other sites

i've done some more testing and the problem is with this bit of code:

 

 

// kev clip start ?
$product_clip['url'] = tep_get_urlclip($listing[$x]['products_id']);
//kev clip end

(which pulls the field from the DB..

 

and this bit which displays it:

 

/// kev clip  start
case 'PRODUCT_LIST_URL':
           $lc_align = 'center';
        if( (tep_not_null($product_clip['url']))) {      $lc_text = '<a href="play_real.php?product_id=' . $listing['products_id'] . '">' . tep_image_button('preview_mp3.gif', IMAGE_BUTTON_MP3) . '</a>';
        } else {
     $lc_text = '-';
        }
          break;         
/// kev clip   end

 

foes some reason since add SPPC $product_clip['url'] is always null and therefore the IF statment is throwing me out and running ELSE instead...

 

but i don't know why :(

Edited by kev@num
Link to comment
Share on other sites

i've done some more testing and the problem is with this bit of code:

// kev clip start ?
$product_clip['url'] = tep_get_urlclip($listing[$x]['products_id']);
//kev clip end

(which pulls the field from the DB..

 

and this bit which displays it:

 

/// kev clip ?start
case 'PRODUCT_LIST_URL':
? ? ? ? ? ?$lc_align = 'center';
? ? ? ? if( (tep_not_null($product_clip['url']))) { ? ? ?$lc_text = '<a href="play_real.php?product_id=' . $listing['products_id'] . '">' . tep_image_button('preview_mp3.gif', IMAGE_BUTTON_MP3) . '</a>';
? ? ? ? } else {
? ? ?$lc_text = '-';
? ? ? ? }
? ? ? ? ? break; ? ? ? ? 
/// kev clip ? end

 

foes some reason since add SPPC $product_clip['url'] is always null and therefore the IF statment is throwing me out and running ELSE instead...

You seem to have done everything right, assuming you have put the first bit of code in the right loop.

 

The thing that strikes me as odd is that you use an array to store a single value? Perhaps $product_clip = tep_get_urlclip($listing[$x]['products_id']); would be more appropriate?

 

Of course it would be much more efficient to adapt the code that gets the special prices and the group prices to get this information about the clips in one mysql query instead of firing off a query for every product in the listing.

Link to comment
Share on other sites

Hey all,

 

Is there a way to set a customer group so that they must buy a minimum quantity of the products? For example, I want to be able to set in the admin so that the Wholesale group must by at least 50 units, or they will not be able to checkout. Any ideas?

 

Thanks,

DC

Link to comment
Share on other sites

Is there a way to set a customer group so that they must buy a minimum quantity of the products? For example, I want to be able to set in the admin so that the Wholesale group must by at least 50 units, or they will not be able to checkout. Any ideas?

Quantity Price Breaks for SPPC will do that on a per product basis (it resets the quantity to the minimum if anything lower is added to the cart) but not on a minimum order amount basis (so 50 units made up of several products).
Link to comment
Share on other sites

Also, I wanted to know if anyone has ever had this problem before with running Easy Populate with SPPC:

 

It seems after I installed the two contribs to work together, everything was fine until I noticed one thing. The product price is changing when I upload my data through Easy Populate. In fact, what looks like is happening is that the prices I enter in are being treated as the Gross Amount (after taxes), so that the actual cost of the product that displays on the product page (Net Amount) ends up being the amount entered into my spreadsheet MINUS the percentage of sales tax. So if I enter in $8 for my product price on my spreadsheet, and then upload through Easy Populate, the price ends up to be $7.33. It's vert strange, and very frustrating.

 

Does anyone know of a fix, or someway to disable the function that is making this calculation happen? I DO NOT display my products with the sales tax, and I really don't care if the calculation is made for each product on the admin or catalog side, just as long as the taxes are added in on checkout, that's all that matters to me. Thanks,

DC

Link to comment
Share on other sites

You seem to have done everything right, assuming you have put the first bit of code in the right loop.

 

The thing that strikes me as odd is that you use an array to store a single value? Perhaps $product_clip = tep_get_urlclip($listing[$x]['products_id']); would be more appropriate?

 

Of course it would be much more efficient to adapt the code that gets the special prices and the group prices to get this information about the clips in one mysql query instead of firing off a query for every product in the listing.

 

 

hi, Thanks for your help... i've tried doing what you said and moving the first part into the right loop.. but i still keep going through the ELSE part in my second bit of code... do you know if this is the right place to put the first part?

 

	while ($_listing = tep_db_fetch_array($listing_query)) {
$listing[] = $_listing;
$list_of_prdct_ids[] = $_listing['products_id'];
}

 

Thanks again :)

Link to comment
Share on other sites

do you know if this is the right place to put the first part?

 

	while ($_listing = tep_db_fetch_array($listing_query)) {
$listing[] = $_listing;
$list_of_prdct_ids[] = $_listing['products_id'];
}

You should put it much, much lower: right after the for ($x = 0; $x < $no_of_listings; $x++) { in this part (around line 145):

    } // end if(!empty($new_s_prices)
} // end for ($x = 0; $x < $no_of_listings; $x++)
   
//    while ($listing = tep_db_fetch_array($listing_query)) { (was original code)
for ($x = 0; $x < $no_of_listings; $x++) {

Link to comment
Share on other sites

thanks mate! i was hoping you'd have time to take another look :)

 

it seems to have done the trick.. i think i might have put this there before:

 

// kev clip start  
$product_clip['url'] = tep_get_urlclip($listing[$x]['products_id']);
//kev clip end

 

but since you suggested changing it to :

 

// kev clip start  
$product_clip = tep_get_urlclip($listing[$x]['products_id']);
//kev clip end

 

and putting it in the place it works!!!!!!

 

i can't thank you enough.. i find it very frustrating when i can't figure something out.. especially when it's probably so obvious to someone else!!!

 

You're a gentleman and a scholar!

Link to comment
Share on other sites

thank Jan, you gave me just the right information to find the problem.  the error is in the documentation - Marvin ATTENTION!

 

Look at this piece of code near the end of includes/modules/product_listing.php file:

 

break; // EOF Separate Pricing per Customer
? ? ? ? ?case 'PRODUCT_LIST_BUY_NOW':
? ? ? ? ? ?$lc_align = 'center';
? ? ? ? ? ?$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
? ? ? ? ? ?break;

 

the "$listing[$x]" is outside the SPPC marker.  I missed making that change when I compared and updated files.  Because it fell outside the SPPC mod markers (but inside my 'free shipping' mod markers) I ignored the change.  I have added the missing "[$x]" and it works perfectly now.

 

thank you again for your help and a great mod.

 

Your beta gamma tester  :'(

 

Piquet

 

HAH! The X-file :lol:

Thanks for that - I had the same exact problem, but with the DisableBuyNow and ShoppingCart1 contribution! Adding in the [$x] fixed it, a fine success experience late in the day. Will continue slogging through this l-o-n-g thread to see if I can find a couple more answers, but THIS put me on the map - I COULD go live, thanks to this fix - THANK YOU.

GREAT Contribution this SPPC - had a few snags, but installation wasn't as bad as it seemed at first glance.

 

BTW - the patience practiced on this particular thread is refreshing - it can be quite intimidating to figure all this out when you're not an expert (or anywhere near...) - so multiple kudos!

Link to comment
Share on other sites

Now I'm getting all kinds of errors.

 

On left hand column:

 

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/wizlair/public_html/catalog/includes/functions/database.php on line 103

 

And also get the same error on all product listings.

 

 

I am getting this too was a solution ever reached? Thanks

 

maddie

Link to comment
Share on other sites

Jan.. the last changes you gave me worked perfectly..

 

Now I am trying to accomplish one more task before I move on..

 

when the account is changed to wholesale (#3 in my case) I get an email but it's not correctly including the info (it will be a you have been approved for wholesale content). Also I was hoping to turn off the RA light when this is accomplished..

 

here is the code in question from admin/customers.php

 

        tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array, 'update', "customers_id = '" . (int)$customers_id . "' and address_book_id = '" . (int)$default_address_id . "'");

$old_customers_group_id = $_POST['old_customers_group_id'];
if ($old_customers_group_id <= 2 && $customers_group_id >= 3) {
  $sql_data_array['customers_group_ra'] = '0'; //trying to turn off RA light
$name = $customers_firstname . $customers_lastname;
// perhaps email_text should start with greeting: Dear mr./mrs " . $customers_lastname . ",\n\n
$email_text = EMAIL_WELCOME3;
tep_mail($name, $customers_email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
} // end if ($old_customers_group_id <= 2 && $customers_group_id .>= 3)

 

and the relevent portion of the email I received:

 

Subject: EMAIL_SUBJECT

 

EMAIL_WELCOME3

 

thanks

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

Jean-Pierre/Jeep,

From what I can find back, to make it work with Country-State Selector you only need to make additional changes for SPPC to two files. That is includes/modules/address_book_details.php, the changed file was posted here and to catalog/address_book_process.php which I will post below.

 

Hi JanZ,

 

Ok, I tested the contribution Country-State Selector Version 1.2.1 and I do everything what the author tell to do and everything is working fine with SPPC 4.1 but the only thing I see you have changed in the address_book_process.php is the adding of the following line :

 

     if (ACCOUNT_COMPANY == 'true') $entry['entry_company_tax_id'] = $company_tax_id;

 

What this line is supposed to do because I don't see any difference when adding this line ? I don't know what Bob Cat Driver :P complaint, anyway, thank for your work JanZ. :thumbsup:

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Hey there folks!

 

I'm trying hard to get up to speed with osc and all the contributions. Sometimes it's really exciting to see something work sometimes it's not so great when things fall apart. I'm hoping I can get some help from a smartie out there.

 

I have added both sppc and easy populate to my osc installation and I was wondering how the two work together. My problem is that I have added almost 1000 products with EP, and it's gone well, but now I have to go back and add a wholesale price to those products.

 

I was wondering if there is an easy way that I can add the wholesale price through EP and the spreadsheet thing.

 

I tried to do this myself by setting a single product with a wholesale price and then searching through the spreadsheet to find where the wholesale column was so that I could then modify it for all my products. But I couldn't find the wholesale price anywhere on the spreadsheet. When I downloaded just the product number, the price and the quantity the spreadsheet that EP gave me had the wholesale price as a column and I changed it for all of my products but then got an error which said

File uploaded.

Temporary filename: /tmp/phpJPapl1

User filename: wholesale.txt

Size: 25631

| 16 | 12 | 1 | 6 | 1 | | Updated

1136 - Column count doesn't match value count at row 1

 

INSERT INTO products_groups VALUES ( 1, 6, 63, 12 )

 

[TEP STOP]

 

So, I'm asking for help because I tried and I just don't really know where to go from here.

 

I don't want to have to go to each one of those products and add the price through the web interface, that would kill me.

 

I hope y'all can help.

 

thanks.

 

;-j

Link to comment
Share on other sites

Hey there folks!

 

I'm trying hard to get up to speed with osc and all the contributions. Sometimes it's really exciting to see something work sometimes it's not so great when things fall apart. I'm hoping I can get some help from a smartie out there.

 

I have added both sppc and easy populate to my osc installation and I was wondering how the two work together. My problem is that I have added almost 1000 products with EP, and it's gone well, but now I have to go back and add a wholesale price to those products.

 

I was wondering if there is an easy way that I can add the wholesale price through EP and the spreadsheet thing.

 

I tried to do this myself by setting a single product with a wholesale price and then searching through the spreadsheet to find where the wholesale column was so that I could then modify it for all my products. But I couldn't find the wholesale price anywhere on the spreadsheet. When I downloaded just the product number, the price and the quantity the spreadsheet that EP gave me had the wholesale price as a column and I changed it for all of my products but then got an error which said

So, I'm asking for help because I tried and I just don't really know where to go from here.

 

I don't want to have to go to each one of those products and add the price through the web interface, that would kill me.

 

I hope y'all can help.

 

thanks.

 

;-j

 

Make sure you make all the edits to the easy_populate.php file that are explained in this post:

http://www.oscommerce.com/forums/index.php?sho...ndpost&p=610151

 

Jeep does a fine job clearly explaining things! After you make these edits successfully, and if the rest of the code is still intact, you should not have any problems with your upload.

Link to comment
Share on other sites

Make sure you make all the edits to the easy_populate.php file that are explained in this post:

http://www.oscommerce.com/forums/index.php?sho...ndpost&p=610151

 

Jeep does a fine job clearly explaining things! After you make these edits successfully, and if the rest of the code is still intact, you should not have any problems with your upload.

 

Dave! Thanks so much for pointing me in the right direction! That worked like a charm. I can't tell you what a relief that is. Be well.

Link to comment
Share on other sites

Hi,

 

Does anybody knows where sppc calculates the price that shows up in the shoping_cart.php?

 

If i'm not wrong i found the subtotal in the classes/shoping_cart.php but i think the real calc is in the PriceFormatter.php (made for sppc).

 

However it seems like i cant find it.

 

Kind Regards,

Tom

Even in this dark place, yes, I am afraid of my own shadow.

 

 

 

Contributions | KnowledgeBase | osCommerce 2.2 pdf

Link to comment
Share on other sites

oh wicked, where is it? ;)

 

i could do with that too..

 

Sorry - should have added the answer to my question - but realy - i'm a beginner - and actualy i'm still not sure if i'm 100% correct here - but when i mess around with the code it changes on my catalog - so i guess i'm right ...

 

In the classes/shopping_cart.php you got somewhere:

 

return $this->total += tep_add_tax($products_price, $products_tax) * $quantity;

 

and in the classes/currencies.php you got:

 

      return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);

 

its somewhere in the display_price function and again in the display_netto_EH_price.

 

I'm still rather confused on how it all works - it looks like osc handles prices in two ways - my shoppingcart (box) and the sub total in my shoppingcart (shopping_cart.php) and the checkout_confirmation and shopping_cart total prices are different calculated >.<

 

I still need to figure it out - its not easy when you only know verry basic php >.<

 

I already added a verry complicated price-calculation to it instead of the posted code above.. but its not working ...

 

Been a couple of days now trying to figure out how osc does it calculations and what jan did with all of it :P

 

 

kind regards,

tom

Even in this dark place, yes, I am afraid of my own shadow.

 

 

 

Contributions | KnowledgeBase | osCommerce 2.2 pdf

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...