Jump to content
Sign in to follow this  
elari

CONTRIBUTION - Customer Status update v1.1

Recommended Posts

Create as you want customers status, the discount that will display on each product ,and if is member_flag will ot_discount that will apply for ot_xmembers module. You can select both discount like 15% on all products and again 5% in order_total if amount higher that what you decide in ot_xmembers

http://www.itgsm.com/dload-osc/customers_s...1/cs_create.jpg

 

display all existig customers_status

http://www.itgsm.com/dload-osc/customers_s...1.1/cs_list.jpg

 

Manage customers and show icon for each customers_status. The status is now also displayed in full text (and number) after the name

http://www.itgsm.com/dload-osc/customers_s...ist_show_cs.jpg

 

Customers_status now also displayed when editing the customers info in admin pannel

http://www.itgsm.com/dload-osc/customers_s...dit_show_cs.jpg

 

You can select to display only list of one kind of customers, usefull to manage new customers that just log in the shop and that you have to change the status

http://www.itgsm.com/dload-osc/customers_s...tomer_by_cs.jpg

 

Changing customer status of a customer display history of all change made for this customer

http://www.itgsm.com/dload-osc/customers_s..._cs_history.jpg

 

After change in catalog (many files to change) all price will display with the customer_status discount when customer log in....

Example for dafoc (discount set to 100% for new customers) , the price displayed will be 0 until you change the status of the logged in customer. If you install contrib that show prices only to customers that create account and log in, nobody else than trustable customers will see the prices

http://www.itgsm.com/dload-osc/customers_s...t_for_dafoc.jpg

 

Hope you'll tell me soon what does not work properly :)))

Share this post


Link to post
Share on other sites

Customers Status for newsletter manager

I mainly reused work of Harald to write the choose_audience in newsletter manager

It is 60% finished but i need help of smb having knowledge in javascript...

Maybe Harald you should help me :))))

 

When you sent a newsletter (not products...) you can now select the groups of customers you want to sent this newsletter

http://www.itgsm.com/dload-osc/customers_s...s_to%20send.jpg

 

And now it display history of groups of customers you have sent newsletter and date... i have added a table newsletters_history for that

http://www.itgsm.com/dload-

osc/customers_status/screenshot_cs_1.1/news_sent_cs_history.jpg

 

For those who don't undestand need of customers status :

-manage membership levels

-manage discount according to each groups of customers

-manage order total discount

-manage resellers

-manage trusting in customers

.....

 

Here are first run of install newsletter management...

http://www.itgsm.com/dload-osc/customers_s...stall%201.0.txt

Here is the newsletter module that need to be reworked in javascript part to work for selecting customers status...

http://www.itgsm.com/dload-osc/customers_s...0newsletter.php

And the newsletter main part in admin

http://www.itgsm.com/dload-osc/customers_s...newsletters.php

Share this post


Link to post
Share on other sites

:? I had a little problem with displaying the customers discount prices when logged in. I solved this in the following way:

  • * Modification in catalog/includes/aplication_top.php

Added customers_status

*/

// Customer Status v0.5b + Updated 1.1 - Define here value $discount_price to calculate discount in all later page

if (tep_session_is_registered('customer_id')) {

$customer_status_discount_query = tep_db_query("SELECT customers_status_name, customers_status_discount, customers_status_ot_discount_flag, customers_status_ot_discount, customers_status FROM " . TABLE_CUSTOMERS . " left join " . TABLE_CUSTOMERS_STATUS . " on customers_status = customers_status_id where customers_id='" . $customer_id . "' and language_id = '" . $languages_id . "'");

$customer_status_discount = tep_db_fetch_array($customer_status_discount_query);

$customer_status_name = $customer_status_discount['customers_status_name'];

$customer_discount_price = $customer_status_discount['customers_status_discount'];

$customer_ot_discount_flag = $customer_status_discount['customers_status_ot_discount_flag'];

$customer_ot_discount = $customer_status_discount['customers_status_ot_discount'];

$customers_discount_status = $customer_status_discount['customers_status'];

// echo $customers_status_discount['customers_status_name'], $customers_status_discount['customers_status_discount'] , $customer_status_discount['customers_status_ot_discount_flag'], $customer_status_discount['customers_status_ot_discount'];

echo $customer_status_name, $customer_discount_price, $customer_ot_discount_flag, $customer_ot_discount, $customers_discount_status;

} else {

$customer_status_name='';

$customer_discount_price='0';

$customer_ot_discount_flag ='0';

$customer_ot_discount ='0';

$customers_discount_status ='0';

}

// End add V0.5b

 

 

 

/* Modification in catalog/includes/functions/general.php

added global $customers_discount_status, $customer_discount_price and "if ($customers_discount_status > 1)..."

*/

// Add tax to a products price MODIFICATION

function tep_add_tax($price, $tax) {

global $currencies, $customers_discount_status, $customer_discount_price;

if (DISPLAY_PRICE_WITH_TAX == true) {

if ($customers_discount_status > 1) {

$price = $price * (100 - $customer_discount_price) / 100;

}

return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']) + tep_calculate_tax($price, $tax);

} else {

if ($customers_discount_status > 1) {

$price = $price * (100 - $customer_discount_price) / 100; }

return tep_round($price, $currencies->currencies[DEFAULT_CURRENCY]['decimal_places']);

}

}

 

But a little problem still exists. How can I write the correct prices in the table order_products? I order_products are still the full prices without the discount. Any help is welcome. Please excuse my english.

Axel Benkert

Share this post


Link to post
Share on other sites

but before i have to finish work on customers status for newsletter ...

Share this post


Link to post
Share on other sites

sorry

in fact in catalog i also use now same two function defined for admin / functions/general.php that are :

function tep_get_customers_statuses()

function tep_get_customer_status($customers_id)

 

i think i will not need use of $customers_discount_status you added because in fact the discount itself will be used to calculate price without any need to check. i mean that if discount = 0% the price is always multiplicated by (100 - discount) / 100 = 1. so i just need to apply this formula to any price when the price is readed from the products database...

 

for finishing the display & store price i wait to see how will work the checkout process when finished... hope soon :)

elari

Share this post


Link to post
Share on other sites

Today evening I tried the following in catalog/checkout_process.php:

  • // Update products_ordered (for bestsellers list)

tep_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . tep_get_prid($order->products[$i]['id']) . "'");

// MOD BENAX

if ($customers_discount_status > 1) {

$sql_data_array = array('orders_id' => $insert_id,

'products_id' => tep_get_prid($order->products[$i]['id']),

'products_model' => $order->products[$i]['model'],

'products_name' => $order->products[$i]['name'],

'products_price' => $order->products[$i]['price']* (100 - $customer_discount_price) / 100,

'final_price' => $order->products[$i]['final_price']* (100 - $customer_discount_price) / 100,

'products_tax' => $order->products[$i]['tax'],

'products_quantity' => $order->products[$i]['qty']);

} else {

$sql_data_array = array('orders_id' => $insert_id,

'products_id' => tep_get_prid($order->products[$i]['id']),

'products_model' => $order->products[$i]['model'],

'products_name' => $order->products[$i]['name'],

'products_price' => $order->products[$i]['price'],

'final_price' => $order->products[$i]['final_price'],

'products_tax' => $order->products[$i]['tax'],

'products_quantity' => $order->products[$i]['qty']);

}

tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);

$order_products_id = tep_db_insert_id();

I wrote the same for the $products_ordered_attributes. It seems to work, but I have to test it. Now it's too late for me and I got headache :wink:

 

Axel Benkert

Share this post


Link to post
Share on other sites

i will use it to finish temp update until new checkout process works.

Share this post


Link to post
Share on other sites

Elari,

 

Where can I find the ot_xmember.php refered by customer status

modifications ...

 

Create as you want customers status, the discount that will display on each product ,and if is member_flag will ot_discount that will apply for ot_xmembers module...  

<--snip -->

http://www.itgsm.com/dload-osc/customers_s...status_v1.1.zip

<--snip -->

 

 

I looked through the earlier version .zips, searchd the forums and contributions but no success. Can anyone can guide me to find ot_xmembers module

 

New to OsCommerce, looks like something I would like to use.

Please help.

 

Have a good week :)

ibandyop


ibandyop

Share this post


Link to post
Share on other sites
Here is the newsletter module that need to be reworked in javascript part to work for selecting customers status...

http://www.itgsm.com/dload-osc/customers_s...0newsletter.php

And the newsletter main part in adminhttp://www.itgsm.com/dload-osc/customers_s...newsletters.php

 

Elari,

Is it possible to rename the files to .phps or .txt so we can download

and test ?

 

Thanks in advance,

ibandyop


ibandyop

Share this post


Link to post
Share on other sites

sorry i did not check that the files will not be readed but interpreted....

 

thanks if you have knowledge in javascript i think there are some object to rename correctly but i don't know how to do that...

Share this post


Link to post
Share on other sites

Hi Elari,

the formula

*(100-$customer_dicount_price) / 100

 

is not easy to implement into default.php, advanced search results etc. pp

 

Please look at this files and tell us, how we may change it there to work well.


xtcommerce Templates

And this is my new coding project. A multilingual sitesearch for online stores. Have a look at the search field left in the navbar:

WWW.BE-INSHAPE.DE Proteinpulver, Aminosäure Liquids and Supplements for Bodybuilding and Fitness

It finds all the ingredients like amino acids, carnitin and proteins if you don't know how to spell. In realtime...

Share this post


Link to post
Share on other sites

Hi all,

 

I got snapshot 20020930 and applied all the files available on sourceforge for the elari mod and I get the following...

 

for admin/customers.php

 

1054 - Unknown column 'c.customers_status' in 'field list'

 

select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_email_address, a.entry_country_id, c.customers_status, c.member_flag from customers c left join address_book a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id order by c.customers_lastname, c.customers_firstname limit 0, 20

 

and for the catalog...

 

1054 - Unknown column 'customers_status' in 'on clause'

 

SELECT customers_status_name, customers_status_discount, customers_status_ot_discount_flag, customers_status_ot_discount FROM customers left join customers_status on customers_status = customers_status_id where customers_status_id='2' and language_id = '1'

 

I have added the new table to the DB and altered the customers table. I assume this is a bug or I have done something wrong??

 

can anyone help?

Share this post


Link to post
Share on other sites

there are some sql change to make with phpmyadmin

look at install version 1.0 and in 1.2

i will try to make a all in one sql file when i'll finished all the work

Share this post


Link to post
Share on other sites

Thanks for the prompt replys :)

 

So what tables do I need? I have now tried the config suggested in version 1.0 and and 1.2 and both give me that same error....

Share this post


Link to post
Share on other sites

Elari' customer status on CVS! :wink:

 

http://cvs.sourceforge.net/cgi-bin/viewcvs...by=date#dirlist

 

There you will find everything you will need.


xtcommerce Templates

And this is my new coding project. A multilingual sitesearch for online stores. Have a look at the search field left in the navbar:

WWW.BE-INSHAPE.DE Proteinpulver, Aminosäure Liquids and Supplements for Bodybuilding and Fitness

It finds all the ingredients like amino acids, carnitin and proteins if you don't know how to spell. In realtime...

Share this post


Link to post
Share on other sites

Control everything and mail me, that I may send you a install 1.3 which is a little bit less confusing.

guido.winger@post.rwth-aachen.de

 

The mod works perfectly. First I have had problems, too. But afterwards I found that I made myself mistakes.


xtcommerce Templates

And this is my new coding project. A multilingual sitesearch for online stores. Have a look at the search field left in the navbar:

WWW.BE-INSHAPE.DE Proteinpulver, Aminosäure Liquids and Supplements for Bodybuilding and Fitness

It finds all the ingredients like amino acids, carnitin and proteins if you don't know how to spell. In realtime...

Share this post


Link to post
Share on other sites

check your tables they must look like this

CREATE TABLE customers (

customers_id int(11) NOT NULL auto_increment,

customers_gender char(1) NOT NULL default '',

customers_firstname varchar(32) NOT NULL default '',

customers_lastname varchar(32) NOT NULL default '',

customers_dob datetime NOT NULL default '0000-00-00 00:00:00',

customers_email_address varchar(96) NOT NULL default '',

customers_default_address_id int(5) NOT NULL default '1',

customers_telephone varchar(32) NOT NULL default '',

customers_fax varchar(32) default NULL,

customers_password varchar(40) NOT NULL default '',

customers_newsletter char(1) default NULL,

member_flag char(1) NOT NULL default '0',

customers_status int(5) NOT NULL default '0',

PRIMARY KEY (customers_id)

) TYPE=MyISAM;

# --------------------------------------------------------

 

#

# Structure de la table `customers_status`

#

 

CREATE TABLE customers_status (

customers_status_id int(11) NOT NULL default '0',

language_id int(11) NOT NULL default '1',

customers_status_name varchar(32) NOT NULL default '',

customers_status_image varchar(64) default NULL,

customers_status_discount decimal(4,2) default '0.00',

customers_status_ot_discount_flag char(1) NOT NULL default '0',

customers_status_ot_discount decimal(4,2) default '0.00',

PRIMARY KEY (customers_status_id,language_id),

KEY idx_orders_status_name (customers_status_name)

) TYPE=MyISAM;

# --------------------------------------------------------

 

#

# Structure de la table `customers_status_history`

#

 

CREATE TABLE customers_status_history (

customers_status_history_id int(11) NOT NULL auto_increment,

customers_id int(11) NOT NULL default '0',

new_value int(5) NOT NULL default '0',

old_value int(5) default NULL,

date_added datetime NOT NULL default '0000-00-00 00:00:00',

customer_notified int(1) default '0',

PRIMARY KEY (customers_status_history_id)

) TYPE=MyISAM;

# --------------------------------------------------------

 

#

# Structure de la table `orders`

#

 

CREATE TABLE orders (

orders_id int(11) NOT NULL auto_increment,

customers_id int(11) NOT NULL default '0',

customers_status int(11) default NULL,

customers_name varchar(64) NOT NULL default '',

customers_street_address varchar(64) NOT NULL default '',

customers_suburb varchar(32) default NULL,

customers_city varchar(32) NOT NULL default '',

customers_postcode varchar(10) NOT NULL default '',

customers_state varchar(32) default NULL,

customers_country varchar(32) NOT NULL default '',

customers_telephone varchar(32) NOT NULL default '',

customers_email_address varchar(96) NOT NULL default '',

customers_address_format_id int(5) NOT NULL default '0',

customers_status_name varchar(32) NOT NULL default '',

customers_status_image varchar(64) default NULL,

customers_status_discount decimal(4,2) default NULL,

delivery_name varchar(64) NOT NULL default '',

delivery_street_address varchar(64) NOT NULL default '',

delivery_suburb varchar(32) default NULL,

delivery_city varchar(32) NOT NULL default '',

delivery_postcode varchar(10) NOT NULL default '',

delivery_state varchar(32) default NULL,

delivery_country varchar(32) NOT NULL default '',

delivery_address_format_id int(5) NOT NULL default '0',

payment_method varchar(32) NOT NULL default '',

cc_type varchar(20) default NULL,

cc_owner varchar(64) default NULL,

cc_number varchar(32) default NULL,

cc_expires varchar(4) default NULL,

last_modified datetime default NULL,

date_purchased datetime default NULL,

orders_status int(5) NOT NULL default '0',

orders_date_finished datetime default NULL,

comments text,

currency char(3) default NULL,

currency_value decimal(14,6) default NULL,

PRIMARY KEY (orders_id)

) TYPE=MyISAM;

# --------------------------------------------------------

 

#

# Structure de la table `orders_products`

#

 

CREATE TABLE orders_products (

orders_products_id int(11) NOT NULL auto_increment,

orders_id int(11) NOT NULL default '0',

products_id int(11) NOT NULL default '0',

products_model varchar(12) default NULL,

products_name varchar(64) NOT NULL default '',

products_price decimal(15,4) NOT NULL default '0.0000',

products_customers_status_discount decimal(4,2) default NULL,

final_price decimal(15,4) NOT NULL default '0.0000',

products_tax decimal(7,4) NOT NULL default '0.0000',

products_quantity int(2) NOT NULL default '0',

PRIMARY KEY (orders_products_id)

) TYPE=MyISAM;

Share this post


Link to post
Share on other sites

now you select for each product a maximum discount that will be applied for products that have low margin. this way you define standard discount for one status (exp 30% for resellers) but if he want to buy a low margin product discount will only be the lowest one

 

i still search somebody to help me for javascript function for updating newsletter management.... :!:

Share this post


Link to post
Share on other sites

Hey guys,

 

Just to let you know I was missing a few things in the DB however I still have a few things that are not working. As this is under heavy development at the moment I will wait a few days b4 trying again. Please let me know when you think its done and I can do some testing for you.

Share this post


Link to post
Share on other sites

i just finished some work that MUST be done and i published package in cvs. taka care files includes change for all mods i installed (like helpdesk, description in listing, account customer confirm for cod)

it will be hard for me to remove all these part but they are documented

i will try later to make some more screenshots and an all in one sql query

Share this post


Link to post
Share on other sites

take it here

https://sourceforge.net/project/showfiles.p...?group_id=64659

 

correct some bugs and ONLY BEGINING integration of staffelpreis (qty discount price) module in admin. this will allow to have price / qty for each customer status (end users, members, resellers... )avalaible in your admin. for instance only set the staffelprice allowed for each customers status

Share this post


Link to post
Share on other sites

I'm realy confused, i can't get the status thing working!

 

Do you already have 1 sql statement?

I want to use the current development version 2.2, i just want to copy all your files over the files of the project en run a sql query trough phpmyadmin and i would like it to work than! any clues?


"If we don't succeed, we run the risk of failure." George W. Bush, Jr

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
Sign in to follow this  

×