Question:
Update product prices using PHP/mySQL?
anonymous
1970-01-01 00:00:00 UTC
Update product prices using PHP/mySQL?
Seven answers:
anonymous
2008-01-09 08:40:44 UTC
I have a suggestion, you have a lot of work ahead of you and another solution may be the best option. What you want to do will select the price dynamically from the database, but you are still going to have a lot of static elements, and you will have to hand code the product id's into every product on every page.



I suggest setting up a new shopping cart that you can use for your catalog pages. I recommend OScommerce http://www.oscommerce.com, it is opensource and free to use. There are a lot of indepndantly written conributions/modifications you can install to customize the store. You will have to learn a little bit about PHP to install contributions, but most of them have well written instructions. With OScommerce, there is a contribution called ezpopulate. After you install it, you can modify every product in the store (and add aditional products) by uploading an excel spreadsheet. That will make it much easier to manage your store in the long run. You can completely redesign it to fit your website by modifying files in /includes (header, footer, left nav, right nav). Catalog pages are created in the store dynamically from the database. So as soon as you edit your database the changes will appear on you site, so you don't have to make manual html changes. There is a pretty big learning curve depending on how much PHP you already know.



As far as search engine optimization, I would not try to optimize the dynamic catalog pages. What I have always done in the past is set up OScommerce in a directory like /cart or /store and set up static html pages in the site root. These pages will be your search engine landing pages, and they will direct your visitors into the catalog pages. So instead of listing every product in X category on the X category landing page, have detailed information about X category on that page and then direct users into the X category catalog.



OScommerce does have a couple search engine friendly contributions, but creating HTML landing pages has always worked out better for me.



PM me if you want any live examples.
Doris
2016-03-17 10:20:34 UTC
there are a couple ways to do this 1. create a database and let him login in to PHPmyAdmin and update the prices 2. create a database and teach him how to import data from spreadsheet csv file, that way he can just update the prices in Open Office or Excel then empty the database & import the information. 3. create a database and write a script in PHP to update the information. 4. it could be done in a flat file ie: just a delimited text file, again using PHP Good luck.
princessil0523
2008-01-09 08:43:30 UTC
USE OSCOMMERCE
fretless
2008-01-09 08:23:35 UTC
You'd better design carefully your database and keep all separate fields in different columns, including price.

Then amongst other information you will retrieve from your database you will also the price data.

This way it will be easier to get and update the data (phpmyadmin and other tools are available for viewing and manipulating mysql).

Simple queries (update) will then let you easily update the prices from a form.

You'd better keep data level away from php as it will be difficult to update.
anonymous
2008-01-09 08:20:49 UTC
I had the same problem with this some time ago, i went to downloads.com and found a free program that will change the code in csv or regular excel file into mysql code. Which helped me alot. I will have to get on later and inform you about the program.



Search for Excel to MySql, this program allow you to tell it how many columns and row that are in the file and generates the code for it. You will also need to go to MySQL web site to get the ODBC Connector that will this program to create the code.
anonymous
2008-01-09 08:19:39 UTC
The CSV parsed product file sounds like a great option.



Get a cheap and easy book about PHP and MySQL and you'll be all set.



As far as the database goes, find some basic help for designing databases, it's a whole lot easier when you think it through. Each table needs a unique identifier (even if you don't use it in display), and make sure any one-to-one, many-to-one, one-to-many and many-to-many options are covered.



The easiest way to do it though is a denormalised database (basically a single Excel file that you convert to .csv). You can pretty much do that without learning anything special on the database front.



Umm yeah, you won't have 100 product pages in PHP, you have one PHP page that produces 100 different outputs based on the product ID.



myshop.com/displayitem.php?pid=34 would show item #34. The same page can show any of the items.
J P
2008-01-09 08:17:41 UTC
I think it would make more sense, to have each of the products (name, description, price, photos) stored in the database, then just use PHP to query the database and display the information. If you are going to use dynamic tools like PHP and MySQL, it seems like a waste to hard-code information (like prices) into the PHP page, that wouldn't be much different that hard-coding them into an HTML page.



To get started, I would create a database table that contains your products. Then I would write some PHP to query that database and retrieve that product information. After you've got the data retrieval part down, then think about how to restructure the HTML as PHP, to use the dynamic data.



It sounds like you've got a lot of work ahead of you, good luck :-)


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...