Jump to content

Two Images per Product


Recommended Posts

Guest ecomercial

Name: two_images_mod_2.0.1.zip

Version: 2.0.1

Author: UGAChance

Short Description: Two Images per Product

Long Description:

Ability to use 1 or 2 images per product.

[Download File]

hello

I have cubecart 2.0.1 and upgrade it with yourMod, so now when I introduce a product with 2 photos in Admin, it enter but when I go to the Shop this product not apears.Before upgrade all works fine.

See my site in www.ecomercial.com/storedemo

and Admin part in ../admin

username and passoword - demo.

best regards

Link to comment
Share on other sites

  • 2 months later...
Guest joris3pinter

@Brooky

...i just love your shorthand ;) or compact description of the mod AL.

could you explain what those two images mean?

is it... an elegant solution for the GD engine trouble

(another way of showing a thumbnail and a normal sized pic

or is it something else?

Cheerio Old Man

please elaborate :D

Link to comment
Share on other sites

  • 3 months later...
Guest robxxx123

Hi,

Having the same problem. I just added the script .When i try to view my product it doesnt show in the store. Please advise.

Link to comment
Share on other sites

Guest robxxx123

Use phpAdmin to add the field image2 to the store_inventory table.

How do i dp this exactly?

Can any 1 help me plz. Step by step.

I have php my admin.

Link to comment
Share on other sites

  • 2 weeks later...

Hey,

There is another post around here that explains this mod a little bit more. It solved my problem...

Just don't seem to find it right now...

Tkx

Edited by Pardon__Me
Link to comment
Share on other sites

Guest lido

I uploaded the '2 image' mod and must say, it's quite a nice piece of work. There are, however, some bugs that need to be fixed.

1. The images are sized via html in the view_product.php. This distorted any non-square images. I changed the display to the existing thumb image (img src='images/thumb_$image2') created at upload. A function call to php's GD would be nice.

2. There is some extraneous text that had to be removed - must have been from previous script tests - I guess

3. The 'file size too large' error is still driving me crazy. If anyone figures this out, PLEASE post it. It would be much appreciated.

4. Be sure to add the new field in the inventory table as 'image2' not 'images2' as stated in the docs.

5. The thumb doesn't appear in the admin/add and edit windows. An easy fix though.

Other than some other minor tweaks, Nice job! - it will only get better :(

Link to comment
Share on other sites

Guest lido

Anyone got a screenshot or demo of this mod, so i can see if its what i want?

A good example would be at collegehillarsenal.com. It also incudes the resize function for the 2-up images that's listed in this thread.

Link to comment
Share on other sites

Thats some good mods on there, how can i get mine like that? (the product view i mean) where can i get the mods?

Any help would be brilliant thanks.

Link to comment
Share on other sites

Guest lido

Thats some good mods on there, how can i get mine like that? (the product view i mean) where can i get the mods?

Any help would be brilliant thanks.

The two images mod can be downloaded from the link at the bottom of this thread.

i.e.,

Name: two_images_mod_2.0.1.zip

Version: 2.0.1

Author: UGAChance

Short Description: Two Images per Product

Long Description: Ability to use 1 or 2 images per product.

This is a very nice mod, thanks UGAChance!

After installing and tweaking the "two_images_mod" , add the following sizing function.

---------------------------------------

In order to make the images look correct, I included a sizing function and added it to the html width and height tags.

The 'Include' file (change_image_size.inc.php - or whatever you want to name it) contains the following function: (just cut and paste)

<?php

function imageResize($width, $height, $target) {

//takes the larger size of the width and height and applies the

//formula accordingly...this is so this script will work

//dynamically with any size image

if ($width > $height) {

$percentage = ($target / $width);

} else {

$percentage = ($target / $height);

}

//gets the new value and applies the percentage, then rounds the value

$width = round($width * $percentage);

$height = round($height * $percentage);

//returns the new sizes in html image tag format...this is so you

//can plug this function inside an image tag and just get the width and height

return "width=\"$width\" height=\"$height\"";

}

?>

---------------------------------

Put the following at the top of the page in store/view_product.php:

// Image resize function

include("change_size.inc.php");

(This assumes you named your include file "change_size.inc.php")

---------------------------------

Now, right before the "$imag= . . . ." variables on the 'view_product.php' page (there should be two of them after the "two_image_mod" has been implemented) place the following:

// Get actual image size

//image 1

$item1 = getimagesize("images/$image");

//image 2

$item2 = getimagesize("images/$image2");

// Set target size array(width, height, target)

//image 1

$dimensions= imageResize($item1[0], $item1[1], 150);

//image2

$dimensions2= imageResize($item2[0], $item2[1], 150);

// The number at the end of the $dimensions line will set the target size of your output. Put anything you want there to size your images correctly. 150 works well.

----------------------------------

Now wherever there is a 'width="200 Height="200" '(just after the "$imag= ") replace with the following:

$imag = "<a href=\"#\"><img src='images/$image' $dimensions onClick=\"MM_openBrWindow............yada, yada, yada,

For $image2 just use $dimensions2

-----------------------------------

If you need any help, just post your question here and I'll see if I can answer it for you.

Good luck! :wacko:

Link to comment
Share on other sites

  • 1 month later...

I have a couple questions about this mod. Is it supposed to show the second image even though you did not add one and why does it label the images "Front" And "Back"? I would like to be able to add 2 pics to some products but some dont need it and if one is not entered it just shows a big red X. Any help on how to correct this would be greatly appreciated.

Link to comment
Share on other sites

Guest lido

The "Front" - "Back" labels can be changed to whatever you like. Search for $la_product_desc1 and $la_product_desc2 in admin/lang/English.inc.php. then change it to something like "View A" and "View B" or whatever.

If you have only one item, it should simply resolve to the original single item display. Just make sure the "unavailable image" icon is being displayed as the second view picture. The script uses that icon to determine if you have only one image availble. If it "sees" this icon, it will go to the single view automatically.

It sounds like you may not have the "No Image" icon uploaded to the server or perhaps in the wrong directory.

:)

Link to comment
Share on other sites

  • 3 weeks later...
Guest noodlenugget

I figured out the red x problem....after fucking with the code for way too long..I realized that it wasn't the code. If you're applying this mod to a cart that already has images...you need to edit each product and delete the second image. This will place the nophoto.jpg in for the 2nd image, thus not displaying it on the view_product.php page. I was lucky in that the cart I added this two only had like 6 items. I feel sorry for the person who has 1000+ items and wants to add this mod. Someone should make a fix for this problem.

Link to comment
Share on other sites

Yes!Yes!Yes!!!

I added this mod and it worked!!! Have to say it was made very easy for me as all the pages had been rewritten for a basic installation.

After fluffing up several mods recently and having to back up the store countless times I created a basic store just for testing mods on then when they worked copied the relevant files over to the real store.

Apart from teh fact I now have about 200 products to edit and delete the second image in each store I love this mod. Wish I had tried it from day one.

Added the easy options mod, recent products mod and search in admin mod after I had installed this one. Might even be brave enough now to try adding the discount and coupon mods that I bought!!

Many thanks to noodle nugget for figuring out the red x problem! That would have really annoyed me for ages and as I know zippo php there would have been no chance of using this mod.

Helen

Helshop & House of Lust

Link to comment
Share on other sites

Hi,

Have now sorted out the red x on all 250 products in one store and am starting on the 280 products in the other store. However, one small problem - when I try and add a second image to some items it says file size too big, unless both images are thumbnails it doesnt like it.

Can you tell me what is the maximum image file size per product so that I can compress these images (I know - more time spent doing admin!) and have two decent quality pics instead of two baby thumbnails.

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

Would still like to know file sizes allowed but have come up with temp fix. Using Xat.com Image Optimiser software to optimise pics and lets me have two decent size pics still.

Takes twice as long to add stock with two large images but end result worth it.

Thanks

Link to comment
Share on other sites

  • 2 weeks later...

this mod is great!

just one question. in the description area for my product pages, the text only fills up the left side of the text box (basically, there is text in the section immediately below image1, but the section below image2 on the right side is blank). i would like the text to fill up the box side-to-side before moving to the next line.

can anyone point me to the right line to edit these parameters? i figure it's in the "view_product.php" file, but i'm not sure where (i'm a newbie to php). thanks in advance for the help.

Link to comment
Share on other sites

I found out why the upload of a new image in edit_product.php always fails, says it is too big, and adds info to the DB but doesn't upload file. Enjoy the fix. :D

About line 258 find this

if ($userfile2_size>$max_size) { echo "<p align=\"center\">$la_too_big</p>\n"; exit; }




Replace it with this:




if ($userfile2_size>$max_size2) { echo "<p align=\"center\">$la_too_big</p>\n"; exit; }




About line 264 find this:




if (file_exists($path . $userfile2_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n"



;$escape2=1; }



  if($escape2!=1){

  $res2 = move_uploaded_file($userfile2, $path . $userfile2_name);}

     if($escape2=1){$res2="continue";}



  // Resultant output




Replace it with this:




if (file_exists($path2 . $userfile2_name)) { echo "<p align=\"center\">$la_used_already</p><br>\n"



;$escape2=1; }



  if($escape2!=1){

  $res2 = move_uploaded_file($userfile2, $path2 . $userfile2_name);}

     if($escape2=1){$res2="continue";}



  // Resultant output

Link to comment
Share on other sites

  • 2 months later...

Should be in the admin folder. If you dont have one, here is the core file.

<?php

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

*   File Info: admin/image.php 

*   Purpose:   Display Image 

*   Updated:   31/07/2003 

****************************************************************************   

*   Developer: Alistar Brookbanks (Brooky.com) 

*   Copyright: (C)2003 http://www.brooky.com

*	Copyright: (C)2003 http://www.cubecart.com

*   This program is not "free" software and restrictions apply! 

*   Further Info: http://www.cubecart.com/license.php

*   Contact [email protected] if any conditions are not clear. 

*

*   Licensees holding valid "CubeCart Licence Number" may edit

*   the (powered by CubeCart) from browser title and "Powered by CubeCart"

*   and "(c) Brooky.com" from the web page footer.

*

*   This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING

*   THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR

*   PURPOSE. This and all others in the download package can only be

*	redistributed with written permission from Alistair Brookbanks!

*

*   The "CubeCart License" is available to purchase at

*   https://secure.cubecart.com/

*   For pricing please contact us via e-mail at [email protected] 

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

include("config.php");

include("settings.inc.php");?>

<html>

<head>

<title>

<?

echo"$image";

?></title>

   <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>

   <link rel='stylesheet' href='style.css' type='text/css'>

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<?

echo "<table align='center' valign=\"top\" width='100%' height='100%'><tr><td align='center' valign='middle'><img src='../images/$image'><p>$image</p><p><a href = \"javascript:window.close()\">$la_window_close</a></p></td></tr></table>

";

?>

</body>

<html>

Link to comment
Share on other sites

×
×
  • Create New...