Zen Cart Logo
Forums / General Questions / Links to products from outside store

Links to products from outside store

Views: 1,273

Results 1 to 9 of 9
30 Jun 2011, 10:02 PM
#1
2ndmouse avatar

2ndmouse

New Zenner

Join Date:
Oct 2010
Posts:
11
Plugin Contributions:
0

Links to products from outside store

I have various blog pages on my site that are not part of zen cart.

My product data is kept on an external database and uploaded via easypopulate. The product key field in this database is product model. This database also contains the blog entries.

I would like to know how to make a link using products_model so that I can make links in the blog entries which will then take users on to the product in the shop.

This would be perfect:

http://www.mysite.com/zencart/index.php?main_page=product_info&product_model=123

But it doesn't work.

Any suggestions very gratefully received!

1 Jul 2011, 12:51 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Links to products from outside store

which will then take users on to the product in the shop.
Navigate to the product in your ZenCart

Copy that address for your link

1 Jul 2011, 9:38 AM
#3
2ndmouse avatar

2ndmouse

New Zenner

Join Date:
Oct 2010
Posts:
11
Plugin Contributions:
0

Re: Links to products from outside store

Thanks for getting back to me, and yes that works. BUT I have loads of links to loads of products. My understanding is that easypopulate reassigns a product id each time its used. This means that every time I use easy populate i'll have to manually update all these links. Just not feasible. If I use product_model I have the means of generating the link in my own database ...

I have been looking at this old thread:
http://www.zen-cart.com/forum/showthread.php?t=122446&referrerid=98590

Which addresses what I want to do, but the coding is a bit daunting. I dont't want to mess with core code and the observer_class just seems a bit opaque for my abilities. I'm willing to have a go but I confess I was hoping there might be an off-the-peg solution out there!

Anyway, I appreciate your help. Thanks.

1 Jul 2011, 2:30 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Links to products from outside store

My understanding is that easypopulate reassigns a product id each time its used
If you are seeing that then you are using easypopulate incorrecly

There is a wiki article on using easypopulate

1 Jul 2011, 9:38 PM
#5
2ndmouse avatar

2ndmouse

New Zenner

Join Date:
Oct 2010
Posts:
11
Plugin Contributions:
0

Re: Links to products from outside store

Sorry, I'm not being clear. When/where the product id is generated is not really the issue: my problem is that the product code is not available in my master database. The model number IS available because it is derived from our own product code. This should mean I can write a blog entry in my database and generate the relevant product links right there, quickly, simply and easily updateably. BUT I can't because the only url that will work is based on the product code. Whilst doing this manually ( as I am at present) is possible it's a right pain!

Thank you for taking the trouble to reply, I'm sure this is solvable and it would be SO useful.

1 Jul 2011, 9:43 PM
#6
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Links to products from outside store

my problem is that the product code is not available in my master database.

The model number IS available because it is derived from our own product code
What product code?
What master database?

If I am reading this correctly, there is no default facility for a "Product Code" - -
Even if you have added a record for it - -
Easy Populate is not coded to enter it

1 Jul 2011, 10:25 PM
#7
2ndmouse avatar

2ndmouse

New Zenner

Join Date:
Oct 2010
Posts:
11
Plugin Contributions:
0

Re: Links to products from outside store

What product code?
I should have written product id.

What master database?
The business has existed for years before I recently set up the zen cart site. We have a database (that I rather grandly call the master database) that contains product details and lots of other stuff like customer and supplier details - and blog entries. Relevant product data is exported via a script and uploaded to MYSQL via easypopulate: the model number for zen cart is in fact our internal product code. This all works great.

When I came to the blog entries I thought wouldn't it be great if I could just select which products to link to from the blog right here as I'm writing it, but I can't because the 'master database' doesn't have the product id.

It is true that the method of going to the product page, copying it and pasting it into the blog entry in the database works, but, as I said earlier, it's time consuming and not very elegant. I just sort of hoped that zen cart could be made to recognize a product by its model number (all unique!) and everything would be all shiny and fast ...

It's late and I'm probably being dense so I'm going to bed to see whether that does any good! Thanks very much for your interest and help.

2 Jul 2011, 12:38 AM
#8
gilby avatar

gilby

Totally Zenned

Join Date:
Aug 2005
Location:
Vic, Oz
Posts:
1,816
Plugin Contributions:
0

Re: Links to products from outside store

2ndMouse:

What product code?
I should have written product id.

What master database?
The business has existed for years before I recently set up the zen cart site. We have a database (that I rather grandly call the master database) that contains product details and lots of other stuff like customer and supplier details - and blog entries. Relevant product data is exported via a script and uploaded to MYSQL via easypopulate: the model number for zen cart is in fact our internal product code. This all works great.

When I came to the blog entries I thought wouldn't it be great if I could just select which products to link to from the blog right here as I'm writing it, but I can't because the 'master database' doesn't have the product id.

It is true that the method of going to the product page, copying it and pasting it into the blog entry in the database works, but, as I said earlier, it's time consuming and not very elegant. I just sort of hoped that zen cart could be made to recognize a product by its model number (all unique!) and everything would be all shiny and fast ...

It's late and I'm probably being dense so I'm going to bed to see whether that does any good! Thanks very much for your interest and help.

3 suggestions:

  1. custom php/mysql coding on your blog page (I assume thats probably not possible)

  2. create a custom zen-cart page that take the model number as the parameter and does the php/mysql coding there.

  3. link to the zen-cart "search" function
    http://MySite/index.php?main_page=advanced_search_result&search_in_description=1&keyword=MyUniqueModel
    This will get you one click away from the actual product.

2 Jul 2011, 8:08 AM
#9
2ndmouse avatar

2ndmouse

New Zenner

Join Date:
Oct 2010
Posts:
11
Plugin Contributions:
0

Re: Links to products from outside store

Thanks very much for your suggestions. Following up 2) I found this php code posted a while back by yellow1912:

if(isset($_GET['products_model']) && !empty($_GET['products_model'])){
$product = $db->Execute("SELECT products_id FROM".TABLE_PRODUCTS." WHERE products_model='".zen_db_input($_GET['products_model'])."' LIMIT 1");

if($product->RecordCount()>0)
$_GET['products_id'] = $product->fields['products_id'];
}

This SEEMS to replace the product_id with products_model in the link which is just what I want to do BUT

  1. I don't know if it will still work with the current version of zen cart.

  2. Don't know where it goes! (Dr Byte suggests it should not replace core code).

I will also see whether the search function will work for me (I want to implement a search facility anyway). So, thanks once again!