Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

additional images in product info?


JakeWear

Recommended Posts

Hi there,

 

I was wondering if there was an easy way to add more images to a page. I know how to do it with Javascript, but I was hoping it would be something in the admin level.

 

This is an example. I know the site owner cruises this forum so I'm hoping they will help.

 

http://flirtdesigns.com/catalog/product_in...8dbbd383afb4362

 

 

Thanks

Link to comment
Share on other sites

Hi there,

 

I was wondering if there was an easy way to add more images to a page. I know how to do it with Javascript, but I was hoping it would be something in the admin level.

 

This is an example. I know the site owner cruises this forum so I'm hoping they will help.

 

http://flirtdesigns.com/catalog/product_in...8dbbd383afb4362

Thanks

 

Hi Jake,

 

I created a database table to store the names of the extra images I use in a slideshow. When the product_info.php page opens, I retrieve the product_id, run a MySQL query using Php to retrieve the filenames, and then display them in a table and a slideshow.

 

Hope this helps.

 

Regards,

Kevin.

Link to comment
Share on other sites

Hi Jake,

 

I created a database table to store the names of the extra images I use in a slideshow. When the product_info.php page opens, I retrieve the product_id, run a MySQL query using Php to retrieve the filenames, and then display them in a table and a slideshow.

 

Hope this helps.

 

Regards,

Kevin.

 

 

Thanks Kevin. I guess I will have to figure out something else since I'm not comfortable with MySQL. Oh, and by the way, It's Vicky :)

 

Jake is my dog! ;)

Link to comment
Share on other sites

Thanks Kevin. I guess I will have to figure out something else since I'm not comfortable with MySQL. Oh, and by the way, It's Vicky :)

 

Jake is my dog! ;)

 

 

Oh, did you also move the "Available Options" to the top? Where in PHP can I adjust that?

Link to comment
Share on other sites

Thanks Kevin. I guess I will have to figure out something else since I'm not comfortable with MySQL. Oh, and by the way, It's Vicky :)

 

Jake is my dog! ;)

 

Sorry Vicky, I didnt know.

 

Anyway, I have written down some simple code that you can use. Try it and let me know if you have problems.

 

 

//Code to create database table to store 2 image names

 

CREATE TABLE accessphotos

(product_id integer,

image1 VARCHAR(50),

image2 VARCHAR(50),

CONSTRAINT accessphotos_id_pk PRIMARY KEY (product_id));

 

//Code to insert database data

 

INSERT INTO accessphotos (product_id, image1, image2) VALUES(1, 'image1.jpg', 'image2.jpg');

 

 

//Php cade to include in product_info.php

//MySQL Query

// - image 1's name stored in column 'image1'

// - image 2's name stored in column 'image2'

 

$qry = "SELECT image1, image2

from accessphotos

WHERE product_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'";

 

$result_message=mysql_query($qry);

while ($row = mysql_fetch_array($result_message, MYSQL_NUM))

{

$vimage1= $row[0];

$vimage2= $row[1];

}

mysql_free_result($result_message);

}

 

//The names of the images are stored in the two variables $vimage1, $vimage2

 

 

Good luck!

 

Regards,

Kevin

Link to comment
Share on other sites

Sorry Vicky, I didnt know.

 

Anyway, I have written down some simple code that you can use. Try it and let me know if you have problems.

//Code to create database table to store 2 image names

 

CREATE TABLE accessphotos

(product_id integer,

image1 VARCHAR(50),

image2 VARCHAR(50),

CONSTRAINT accessphotos_id_pk PRIMARY KEY (product_id));

 

//Code to insert database data

 

INSERT INTO accessphotos (product_id, image1, image2) VALUES(1, 'image1.jpg', 'image2.jpg');

//Php cade to include in product_info.php

//MySQL Query

// - image 1's name stored in column 'image1'

// - image 2's name stored in column 'image2'

 

$qry = "SELECT image1, image2

from accessphotos

WHERE product_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'";

 

$result_message=mysql_query($qry);

while ($row = mysql_fetch_array($result_message, MYSQL_NUM))

{

$vimage1= $row[0];

$vimage2= $row[1];

}

mysql_free_result($result_message);

}

 

//The names of the images are stored in the two variables $vimage1, $vimage2

Good luck!

 

Regards,

Kevin

 

Hello again Vicky,

 

I have another alternative to using a database. Insert your product with a thumbnail and note the product_id. Then name your additional images after the product id. So, for example, if your product id is 20, name your additional images image20a.jpg, image20b.jpg, image20c.jpg. Then all you have to do is concatenate the text as follows;

$vimagea = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'a.jpg';

$vimageb = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'b.jpg';

$vimagec = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'c.jpg';

$vimaged = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'd.jpg';

 

This will work nicely if you have a standard number of images for specific categories.

 

Regards,

Kevin

Link to comment
Share on other sites

Hello again Vicky,

 

I have another alternative to using a database. Insert your product with a thumbnail and note the product_id. Then name your additional images after the product id. So, for example, if your product id is 20, name your additional images image20a.jpg, image20b.jpg, image20c.jpg. Then all you have to do is concatenate the text as follows;

$vimagea = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'a.jpg';

$vimageb = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'b.jpg';

$vimagec = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'c.jpg';

$vimaged = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'd.jpg';

 

This will work nicely if you have a standard number of images for specific categories.

 

Regards,

Kevin

 

 

Hi that sounds great! But where would I put that bit of information in?

 

Vicky

Link to comment
Share on other sites

HI, guys.

Been following this thread. I was wondering how I can put several images in my e-shop. The given example with flirt designs is just what I want to see in my site. The thing is - how... Now, I have created the needed DB table. As I want 5 pictures to be associated with my product i have made image1 through image5 fields in my table.

I know how to work with SQL, and I have some experience with ASP, but I am a complete novice to PHP. So, how can I get the form fields for these five aditional pictures to appear under the Image filefield in the add new product form (admin/categories.php)?

Can you please write down the whole piece of code, doing that, as well as tell me where exactly to paste it.

Thank you in advance.

:)

Link to comment
Share on other sites

HI, guys.

Been following this thread. I was wondering how I can put several images in my e-shop. The given example with flirt designs is just what I want to see in my site. The thing is - how... Now, I have created the needed DB table. As I want 5 pictures to be associated with my product i have made image1 through image5 fields in my table.

I know how to work with SQL, and I have some experience with ASP, but I am a complete novice to PHP. So, how can I get the form fields for these five aditional pictures to appear under the Image filefield in the add new product form (admin/categories.php)?

Can you please write down the whole piece of code, doing that, as well as tell me where exactly to paste it.

Thank you in advance.

:)

 

 

Hello bgcolours,

 

You dont load the extra images via the new products form in the admin section. You have to manually upload the images into the specific directory using FTP, and run the SQL script to insert the image names directly using PhpMyAdmin. I am currently developing an application for a client and I have not as yet created a separate HTML form and related php script to insert the image names into the database table, but this task should not take too long, when I get there.

 

Regards,

Kevin

Link to comment
Share on other sites

Hi that sounds great! But where would I put that bit of information in?

 

Vicky

 

Hi Vicky,

 

You can place the following code at the top of your product_info.php page just under the line

' $product_check = tep_db_fetch_array($product_check_query);'

 

Code:

$vimagea = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'a.jpg';

$vimageb = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'b.jpg';

$vimagec = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'c.jpg';

$vimaged = 'image' . (int)$HTTP_GET_VARS['products_id'] . 'd.jpg';

 

 

You can then place your <IMAGE> tags exactly where you want them. The code for the IMAGE tags may resemble the following which opens a popup window to display a larger image.

 

 

echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\" width=\"350\" align=\"center\">\n";

echo " <tr>\n";

echo " <td width=\"50\" > </td>\n";

echo " <td width=\"100\" ><a href=\"java script:validate1('" . $vimagea . "');\"><img src=\"images/subdir/" . $vimagea . "\" border=\"0\"></a></td>\n";

echo " <td width=\"50\" > </td>\n";

echo " <td width=\"100\" ><a href=\"java script:validate1('" . $vimageb . "');\"><img src=\"images/subdir/" . $vimageb . "\" border=\"0\"></a></td>\n";

echo " <td width=\"50\" > </td>\n";

echo " </tr>\n";

echo " <tr>\n";

echo " <td width=\"50\" > </td>\n";

echo " <td width=\"100\" ><a href=\"java script:validate1('" . $vimagec . "');\"><img src=\"images/subdir/" . $vimagec . "\" border=\"0\"></a></td>\n";

echo " <td width=\"50\" > </td>\n";

echo " <td width=\"100\" ><a href=\"java script:validate1('" . $vimaged . "');\"><img src=\"images/subdir/" . $vimaged . "\" border=\"0\"></a></td>\n";

echo " <td width=\"50\" > </td>\n";

echo " </tr>\n";

echo " </table>\n";

 

The Javascript code to open the popup window is as follows. Place near to top of the product_info.php file.

 

<script LANGUAGE="JavaScript" TYPE="text/javascript">

<!--

function popupWindow2(url) {

window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,re

sizable=yes,copyhistory=no,width=900,height=700,screenX=100,screenY=100,top=100,l

eft=100')

}

 

 

function validate1(vproduct)

{

popupWindow2('gallery.php?productid='+vproduct);

}

 

//-->

</SCRIPT>

 

 

Your gallery.php file would include the following:

 

<?php

//*********************************************************

// Get the input parameters

 

$vinputparam1 = $_GET['productid'];

//*******************************************************

 

?>

 

 

 

<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#000000">

<tr >

<td width="100%" align="center" bgcolor="#000000"><IMG height=82 src="images/header.jpg" width="799"></td>

</tr>

<tr >

<td width="100%" align="center" bgcolor="#000000"><BR><BR><img src="images/subdir/<?php echo $vinputparam1;?>" border="0"><BR><BR></td>

</tr>

</table>

<BR><BR>

 

 

Hope this helps.

 

Regards,

Kevin

Link to comment
Share on other sites

  • 1 year later...

Hello. I've been looking for an easy way to add images without adding anything to the database. I've followed the instructions on the last post by kevlev and the images work fine, but the pop-up links don't work. Has anyone had this problem? Do you know how to solve it? Thanks.

Edited by artmonkey
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...