Zen Cart Logo
Forums / General Questions / doing customisations - is this the best way?

doing customisations - is this the best way?

Views: 743

Results 1 to 4 of 4
21 May 2010, 6:23 AM
#1
shaztesting avatar

shaztesting

New Zenner

Join Date:
Jun 2009
Posts:
71
Plugin Contributions:
0

doing customisations - is this the best way?

Hi,

I’m planning on doing some customisations to the cart to integrate it closer to our CMS and customer database. I have a general idea of what is needed and would appreciate any thoughts on the methods below.

Goal 1 – Auto Creating User Accounts
We need to automatically set up users in zencart from user data in our CMS. Before I start coding anything i just want to make sure I know all the tables that I will need to update to create
I guess I would just need to create entries in ‘customers’ and ‘customers_info’ tables? Any others?

Goal 2 – Auto fill new account cart
Is it possible add a certain product with attributes chosen into their cart once we pre-make their accounts in goal 1?
For this i would start with the ‘customers_basket’ table. The ‘products_id’ field seems to be md5 hash or something similar. How do i generate this? Can it just be random as long as it is the same as the ‘products_id’ field in the ’cutomers_basket_attributes’ table?
The ‘cutomers_basket_attributes_id’ field auto increments but it get’s wiped so there is no reference to the previous entry, so i can’t simply just go n+1. how else can i get the latest value for this? Does this have to be auto incremented or can i pick any number since this id doesn’t seem to be saved or cross referenced anywhere else ?

Goal 3 – Auto Login
I was toying with idea (not as important goal as the other two) but i don’t want to be passing the login details via the url as that won’t be safe. Perhaps i should pass it over a form from the website to the store and place the form code on the tpl_login.php? Or is this a bad idea?
Thanks in advance!

22 May 2010, 6:50 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: doing customisations - is this the best way?

Goal 1 - Create customers from old data

You need to build 3 tables:

1 customers
2 customers_info
3 address_book

Goal 2 - pre-propagate the shopping cart on new customers
customers_basket
customers_basket_attributes

Create a customer ...

Add Products to the cart to be pre-populated ...

Look in the two tables and use those values to pre-populate the cart for the new customer ...

Goal 3 ... there isn't a built in auto login in Zen Cart at this time ...

23 May 2010, 12:00 AM
#3
shaztesting avatar

shaztesting

New Zenner

Join Date:
Jun 2009
Posts:
71
Plugin Contributions:
0

Re: doing customisations - is this the best way?

Thanks Ajeh, I really do appreciate your input. Looks like i missed the address_book table, cheers for that.

Ajeh:

You need to build 3 tables:
...

I was just planning on adding entries to the existing tables. is that what you mean? or am I meant to build those exact tables in another database and synch the data? i guess that way i could keep my own history table but i just don't see anything wrong with adding entries to the existing one...

Ajeh:

pre-propagate the shopping cart on new customers
...
any direction on the hash used in the products_id? I have been searching for this in the developers kit but there are 700 files that used 'products_id' and almost 2000 mentions :(

I have been focusing my search on includes/classes/shopping_cart.php because i assume that's where the table entries are written.

In there I have found zen_get_uprid($products_id, $attributes);
is this the code that creates the hash as a function of the product and attribute combination?

i looked it up in the general functions script but couldn't see how it made the unique string so i think i'm searching in the wrong place. What would be so bad about populating my own random string for this if i can't manage to find the proper way?

thanks

23 May 2010, 9:01 AM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: doing customisations - is this the best way?

It is easier to create a customer and add to cart so that you can see the required fields for the Product and the Attributes as they would be built in the customers_basket and customers_basket_attributes to pre-populate the cart on new customers ...

On the databases you have for a customer the 3 tables to manage their customer data, customer info data and the address book data ...

If you make a customer, you will see how these three tables are built for a customer so that you can build the tables from your existing data to import into the zen cart database tables ...