Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Sep 2009
    Posts
    9
    Plugin Contributions
    0

    Default Adding latest products to offsite page

    Well Im sure its been done before, but I cant seem to find it. What I am looking to do is add a "block" of code to one of my pages which does not reside in the same folder as my zencart store...not sure it would technically be considered offsite, but as an example, intended destination is a div block on the main page, www.mysite.com/index.html ... cart is located www.mysite.com/somefolder/zencart/

    Is there any way to call the info for latest items via php and display in the small div block on the main site home page?

    Thanks!!

    ps...sorry if this is not posted in the correct area.
    Last edited by fireball; 23 Mar 2012 at 08:31 PM.

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Adding latest products to offsite page

    Not really the way you describe it.

    What you really need to do is create a bit of php on the home page that:
    1. Connects to the database
    2. Gets the info from the database
    3. Outputs the information to the page.
    Or that is how I would do it anyway. Not that hard but it depends on if you have any knowledge of php and mysql.
    There are other ways of approaching it for sure but it is going to need a bit of programming rather than cutting and pasting.

  3. #3
    Join Date
    Sep 2009
    Posts
    9
    Plugin Contributions
    0

    Default Re: Adding latest products to offsite page

    Thanks for the reply. Sorry, sometimes its hard to explain what is in your head..lol

    Ill admit I have never attempted to do that, but, have some weak knowledge of the concept, and a working understanding of tables within mysql. I just need some example of the code necessary and can probably tweek it to fit my needs.
    Thanks again for any examples you might be able to direct me to!

  4. #4
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Adding latest products to offsite page

    I am not sure that I can find some example code that does what you want it to do.

    Connecting to the database:

    http://www.tizag.com/mysqlTutorial/mysqlconnection.php

    Writing the query:

    http://www.tizag.com/mysqlTutorial/mysqlselect.php

    This actually has pretty much the whole thing in that tutorial. All you need to do is add a ORDER BY part which will order the results in the order that they were added and a LIMIT part to limit the output to 5 ( or whatever ) items.

    Then you are done.

    You are going to ask how to know how to construct the query. Well, the best thing to do is get to grips with phpMyAdmin. This is an application that lets you look at and work with the database directly. You can usually access it through your hosting cPanel.

    I know that this will all seem like a very steep learning curve. But I personally think it is a great thing to do. If you manage it you will have got some new skill that will be fantastically useful. More than that however you will understand a lot more how Zen Cart actually works because you will have written a application that does exactly what Zen does. It gets information from the database and puts it on the user's screen.

    Take it step by step and it won't be to hard. Just get a database conection going first of all.

  5. #5
    Join Date
    Sep 2009
    Posts
    9
    Plugin Contributions
    0

    Default Re: Adding latest products to offsite page

    Thank You..THANK YOU!!

    Thats what I needed!! Those links gave me the basics and I was able to modify my code to work!!

    I DO have one last question tho. Considering the login info contained in the code necessary to pull this off, how secure is it use on a public page?
    I do realize that viewing standard "page source" does not appear to divulge the info, but just wondering..I dont need to be hacked over this.

  6. #6
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Adding latest products to offsite page

    Well, you are right to wonder about this.

    The problem here is that the code has the log in details for your database. A site visitor will not be able to access that information directly. Someone who gains access to your files on the server will be able to see the database log in details.

    The thing about this is that if someone has access to the files on your server you have a few problems anyway. They can easily see the database connection details from the Zen configure files.

    Having said that a better way of doing this would be to put the database configuration details in a file that is above root level in the directory structure so that it can not be accessed from the internet. There are even better ways to secure the details of database access on a server. If you search around on the internet you'll find lots of discussions about this.

    The same logic might well apply to Zen Cart itself...

    Nice one for getting it all to work. If you are happy to do so then I would suggest posting the code that you created so someone coming after you may benefit. Don't worry if it is a bit rough around the edges - just clearly state that it works for you but that you take no responsibility for the code or any security issues. Obviously take out your own personal database details before posting it :-)

 

 

Similar Threads

  1. v151 How to Integrate Latest Products on a CMS page?
    By DArnaez in forum General Questions
    Replies: 7
    Last Post: 19 Aug 2014, 02:21 PM
  2. v150 Creating Manual Entry page for offsite Orders
    By Jeff_Mash in forum Contribution-Writing Guidelines
    Replies: 3
    Last Post: 23 Aug 2012, 02:23 AM
  3. change how latest products works or add new box that displays products we select
    By Sushigal in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 12 Oct 2010, 04:19 PM
  4. adding additional box same as 'latest products' underneath it on home page
    By Sushigal in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 8 Oct 2010, 10:21 AM
  5. Adding a Latest Products/Featured Products box
    By paulograngier in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 9 Feb 2008, 02:01 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR