Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

If it is a new install I can't think of a reason why this would happen since in standard osC there is no column customers_group_id anywhere.

 

JanZ,

 

I have just checked all the tables, and I do have an instance of customers_group_id - in the 'customers' table.

 

Could this be something to do with the problem?

Link to comment
Share on other sites

I do have an instance of customers_group_id - in the 'customers' table.
Then the query must have run already. I can't think of another explanation. Check if the table products_groups and customers_groups exists: if so then it is 100% certain.

 

If it is a new install and you haven't added any other contributions that might use customers_group_id then you should be fine and can go ahead with the rest of the installation.

Link to comment
Share on other sites

I just missed your post on the other page. If those other tables haven't been created I don't have a clue other than that you added a contribution before, that has a customers_group_id associated with it (that means big trouble). If there is a customers_group_ra column in the table customers, the running of the sql script must have stopped somewhere.

 

In that case try to split up the sql queries and go ahead with

DROP TABLE IF EXISTS products_groups;
CREATE TABLE products_groups (
 customers_group_id smallint UNSIGNED NOT NULL default '0',
 customers_group_price decimal(15,4) NOT NULL default '0.0000',
 products_id int(11) NOT NULL default '0',
 PRIMARY KEY  (customers_group_id, products_id)
);[CODE]
and then [CODE]ALTER TABLE specials
ADD customers_group_id smallint UNSIGNED NOT NULL default '0';

etcetera.

Link to comment
Share on other sites

Has someones installed this mod to make it work with OscMax package?

 

If so, I would like to get in touch, I am having a few problems with (most of the time) the BTS template mod that isn't always obvious for implementing the new SPPC module and have a few questions.

If there isn't anybody around installing this mod on oscmax, maybe someone is trying to install it with the BTS template mod?

 

Thanx.

Link to comment
Share on other sites

Janz,

 

I have done a brand new install on a completely different server, installed the mod and all seems to be well.

 

I have a sneaky feeling that one of my fellow developers may have told a porky and I wasn't working on a clean install!

 

Sorry if I panicked anyone!

Link to comment
Share on other sites

...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.

 

That's not a documentation error - that's an installer error! :D

 

You can't go by the //BOF & //EOF lines entirely - when the docs say to highlight block XXXXX and replace it with block YYYYY you have to do that. If you make assumptions about where the code starts and ends it may not work - as you found out.

 

Because I'm not a programmer I didn't want to make assumptions about where the markers began & ended when I put the docs together. In the next release I will see if I can come up with more accurate markers so that even if an installer assumed that the markers were correct - they would be.

 

For the record, I did try to straighten out the markers on the first version of the docs. I found errors caused by my new marking effort and then decided I'd better not try to be a programmer on the docs for this contrib :rolleyes:

 

The code changed a lot - during Beta testing it was changed even more and over time I guess the markers crept around a bit. That's why I chose to include specific blocks of text in the install docs - specifically to eliminate the problem you mentioned.

 

My intent was not to make the line numbers or code markers picture perfect but rather that if a person followed the docs exactly the contrib would work perfectly.

 

Thanks for highlighting that issue.

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

Has anyone had any luck changing product listings to columns (with sppc)?

 

I'm probably overlooking something really simple, but there is a substantial amount of SPPC code in catalog/includes/modules/product_listing.php which complicates the task.

Link to comment
Share on other sites

Has anyone had any luck changing product listings to columns (with sppc)?

 

I'm probably overlooking something really simple, but there is a substantial amount of SPPC code in catalog/includes/modules/product_listing.php which complicates the task.

 

I've seen a number of posts in this thread regarding it, but I have yet to find a definitive answer.

Link to comment
Share on other sites

That's not a documentation error - that's an installer error!  :D

 

You can't go by the //BOF & //EOF lines entirely - when the docs say to highlight block XXXXX and replace it with block YYYYY you have to do that. If you make assumptions about where the code starts and ends it may not work - as you found out.

 

...

 

My intent was not to make the line numbers or code markers picture perfect but rather that if a person followed the docs exactly the contrib would work perfectly.

 

Thanks for highlighting that issue.

 

Hope you didn't take my post as a negative critisicm - it was meant as a 'heads up'.

 

Having read earlier in the thread that it can take two hours to install this mod, I decided to use the compare and update feature in BBedit. the BOF and EOF markers do become important in that case.

 

I guess that means that in the end there are three main ways this (and other contributions) might be installed:

 

* by installing the supplied files

* by following the modification instructions in the accompanying instructions, or

* by using a 'compare and update' feature between the supplied file and the existing shop file.

 

I actually did notice one piece of SPPC code in one of the files that didn't have a BOF/EOF file marker, but you did cover that piece of code in the install instructions.

 

If it is of any assistance, I would be happy to compare the supplied files with your install instructions to make sure that the BOF/EOF markers are consistent with your instructions and send you info on where there might be inconsistency.

 

with the amount of code in this contribution, I think both you and Jan have clearly put in a lot of effort. It is very much appreciated.

 

cheers

 

PK

Link to comment
Share on other sites

Hi Pk;

 

I appreciate the heads-up :D I haven't used BBedit - the first I've ever used a compare program was for this contribution. Because of that it took me a few attempts to get the docs right. I botched quite a few files along the way :'(

 

Because I 'learned' on the fly it was pretty intense. To ensure that I didn't mess it up I did two manual installs following my own instructions using a Text Editor. I felt this was necessary to avoid & vet potential error issues for others :D

 

On my first effort at documenting it I noticed there were lots of places where code was replaced, then a few lines of original code, then a few more new ones. Rather then document it as 3 separate steps I just selected larger chunks of text and made it one easy step. The idea I had in mind was to make it easier & faster for the end-user to install.

 

I discovered that worked - to a point. On my first install based on the docs I found that it broke a bunch of my other contribs. Upon closer inspection I realized that selecting too much code for simplicity's sake came at a price. So I tried to strike a balance of replacing the least amount of extra code in an effort to expedite a person's install with the lowest reasonable chance of error being introduced due to extra code replacement.

 

It's too hard for me to explain - believe it or not there's a reason why it's done the way it is for a manual install. I guess 100% accuracy/purity would be to have //BOF & //EOF after every line that is even slightly modified and then comment out any offending original code - along with documented install steps for each.

 

I entertained that idea at the start but deemed it to be excessive because it became clear the install docs would be very long and put people off by the size of it.

 

There are three ways to install it and this is an excerpt from the docs;

 

TIP: For manual installs don't use a Text Editor - use Compare and Merge (http://www.compareandmerge.com/)

They have a free trial version that works for 50 files. This contrib modifies 35 or so.

 

TIP: Before posting about a problem after installing, check the file listed in the web browser's address to ensure you didn't forget any edits.

 

Like I said, I'm not familiar with the Editor you used but Compare & Merge allows you to just click an arrow and specifically move different code without concern for markers. In my mind it's the easiest/error-free way to do it plus it gives you an extra edge as you can quickly see if the mods are going to interfere with another contrib you may have installed.

 

I appreciate your offer to document the differences for me - what I plan to do is re-examine the issue when the new release comes out (with the few bugfixes that have come up and the new functionality that Jan was speaking of) and then see what can be done to make it 100% perfect.

 

I think it's great that you are willing to help and appreciate the effort we went through - and that makes things like this contrib worth it!

 

Best & Thanks;

Marvin

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

Has anyone had any luck changing product listings to columns (with sppc)?

 

I'm probably overlooking something really simple, but there is a substantial amount of SPPC code in catalog/includes/modules/product_listing.php which complicates the task.

There is a lot of SPPC code, but it is more of an "insert" than a replacement of code. If you keep in mind that $listing['whatever'] has to be altered to $listing[$x]['whatever'] you should be fine.

 

The reason for this is that the array of sql results is already traversed once (with while ...) to pick up the products_id's that are then used to do queries for prices and special prices for customers groups (saves on mysql queries == faster pages). Then instead of a while, a for loop is used and for that you have to make the above change.

 

It shouldn't be very difficult.

Link to comment
Share on other sites

There is a lot of SPPC code, but it is more of an "insert" than a replacement of code. If you keep in mind that $listing['whatever'] has to be altered to $listing[$x]['whatever'] you should be fine.

 

The reason for this is that the array of sql results is already traversed once (with while ...) to pick up the products_id's that are then used to do queries for prices and special prices for customers groups (saves on mysql queries == faster pages). Then instead of a while, a for loop is used and for that you have to make the above change.

 

It shouldn't be very difficult.

 

I wasn't emplying that the SPPC present in product_listing.php is anything other than necessary. I just don't know how to read php (which I'm currently learning) well enough for this additional code not to cause me problems.

 

I'll keep looking.

 

Thanks JanZ

Link to comment
Share on other sites

I wasn't? emplying that the SPPC present in product_listing.php is anything other than necessary.? I just don't know how to read php (which I'm currently learning) well enough for this additional code not to cause me problems.

 

I'll keep looking.

 

Thanks JanZ

 

I should rephrase, I don't know how to read php well enough for ANY php file not to cause me problems (not the inserted SPPC code). :blink:

Edited by adam71o
Link to comment
Share on other sites

I think I learned 90% from what I know of PHP from Matt Zandstra's Teach Yourself PHP in 24 hours. I still pick it up on a regular basis to find out how to do things.

 

That means in three days you could learn almost anything that you ever need to know about PHP ;)

Link to comment
Share on other sites

I think I learned 90% from what I know of PHP from Matt Zandstra's Teach Yourself PHP in 24 hours. I still pick it up on a regular basis to find out how to do things.

 

That means in three days you could learn almost anything that you ever need to know about PHP ;)

 

Is that a book, video, a thread somewhere, or...?

Link to comment
Share on other sites

I would say that something along the lines of this should work:

if ($customer_group_id != '0') { // retail is always '0'
echo 'Welcome to the Retailer site';
} else {
echo 'Welcome to the public site';
}

 

Having now discovered this excellent contribution I have installed it onto my test site to see it in action. One thing that I feel is definately required is a message to state that the prices shown are including or excluding vat and (as above) Welcome to the Retail or Wholesale site. Is there any chance that this small feature could be included in your next release please? :thumbsup:

Link to comment
Share on other sites

Wow, this is a nice contribution - i installed it on my test osCommerce - it took me not more then 5 minutes - done what is said in the readme file - uploaded and run the query - no problems at all - i only had on other contribution installed already (customers add for admin).

 

This works great - but i have a few questions:

 

 

I am just starting to learn php - and have no ideas of its limitations

 

1. Is it posible to add two colums for the price - so when you are logged in as a retailer you can see the 'public'-price and 'your own'-price (maybe simular to what happens when you put in the special but without linetrough then)??

 

2. In this post : http://www.oscommerce.com/forums/index.php?sho...ndpost&p=556240 where you put up the screenshots - you show a way to 'test' the different groups as an admin - i wasnt been able to find how i do that - or what i should click to go and test/login in these deferent groups (for now i work with two acounts i made myself and login in each of them to test)

 

3. Maybe the hardest question: is it posible to make a group see different or more products then another group? Lets say if you are a retailer you view a new product that will only go public a month later.. (as example)..

 

i have no idea if i'm asking the imposible here or not.. just wondering

 

 

Thnx, and pardon my bad english...

 

Grts,

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

Hum - i dont know why i cant edit my post - but anyway - wanted to edit it - so...

 

I didnt notice at first - but the contribution already installed thas not work anymore - since they bouth change the customer.php - anyway - i'm working now on to merge those two - just wanted to say it here - since my previous post aint correct.

 

none the less - this is a great contribution

 

thnx for the hard work to all the makers of it..

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

Tom,

 

Regarding question 1: it needs extra code, but I did this once for product_info.php. It is not bundled with the contribution though.

Question 2: you have to define that email addres in: includes/languages/english/login.php.

Question 3: somebody did make something like that I believe. He said it was almost 100% working and he made it for either totalb2b or b2bsuite. Can't find it right now though.

 

Editing of a post is only possible for a short period of time, that's why...

Link to comment
Share on other sites

Phil,

One thing that I feel is definately required is a message to state that the prices shown are including or excluding vat and (as above) Welcome to the Retail or Wholesale site.
My feeling is that showing that Welcome text is up to the site owner. As shown, it is easy to implement just as having pages that are only shown to certain groups: the link to it can be shown depending on the customer group and if somebody wants to go directly to it, you can send him or her to another page with a Header: Location('index.php') in the top of the page.

 

Regarding showing a text with including or excluding vat: my feeling in this is that it is only wanted my a small group of users. In Europe (at least in a number of countries including the Netherlands) it is against the law to show prices excluding VAT (called BTW) so there you might only want to show it to the wholesale customers (who are accustomed to seeing prices without VAT).

 

In America and Canada people expect to see prices without sales tax added, so it wouldn't be needed there either.

 

If you really need it, I think it is easy to implement it yourself because I assume you only want to use it on a few pages (like product_info.php).

Link to comment
Share on other sites

Hello, this contribution looks like it will be great for the site I'm developing that needs wholesale and retail pricing.

 

My customer offers retail pricing per single product, and wholesale pricing per x quantity. So, for retail it would be $5.95 each and for wholesale it would be 25.95 for a case of 8, for example. Is there a way to indicate this with the contribution? I didn't see it in the screen shots but hopefully this is a common way to price stores?

 

Since I have a bunch of contribs installed already, and have worked very hard to get them all working happily together, I just want to make sure this will do what we need before going through the installation process!

 

Many thanks,

Janet

Link to comment
Share on other sites

Hello, this contribution looks like it will be great for the site I'm developing that needs wholesale and retail pricing. 

 

My customer offers retail pricing per single product, and wholesale pricing per x quantity.  So, for retail it would be $5.95 each and for wholesale it would be 25.95 for a case of 8, for example.  Is there a way to indicate this with the contribution?  I didn't see it in the screen shots but hopefully this is a common way to price stores?

 

Since I have a bunch of contribs installed already, and have worked very hard to get them all working happily together, I just want to make sure this will do what we need before going through the installation process!

 

Many thanks,

Janet

 

I'm with you - i just finished printing the 75 install.txt document for reference and will start modifying my files tonight. This contrib changes 35 files!

Brian Neuman

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...