68 Classifieds Forums

Thumbnail previews in Checkout (Step 4)

This is a discussion on Thumbnail previews in Checkout (Step 4) within the v3.1 Questions & Support forums, part of the v3.1 Legacy Help & Support category; Hi guys, Is there any quick(ish) way of doing a "mini-image management" section in step 4 of the checkout? In ...


Go Back   68 Classifieds Forums > v3.1 Legacy Help & Support > v3.1 Questions & Support

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 05-08-2007, 09:41 PM
ginggs's Avatar
Junior Member
 
Join Date: Mar 2007
Posts: 20
Rep Power: 8
ginggs is on a distinguished road
Default Thumbnail previews in Checkout (Step 4)

Hi guys,

Is there any quick(ish) way of doing a "mini-image management" section in step 4 of the checkout? In other words - allow people who are placing an ad to see thumbnails of the images they've placed so far and possibly delete those which they may have accidentally placed before they complete the checkout process?

I will try and do it myself in the meantime, but if anyone else has done this, or knows of a good way to do it, can they let me know?

Thanks,

George

Reply With Quote
  #2  
Old 05-29-2007, 08:53 PM
ginggs's Avatar
Junior Member
 
Join Date: Mar 2007
Posts: 20
Rep Power: 8
ginggs is on a distinguished road
Default RESOLVED: Thumbnail previews in Checkout (Step 4)

Hullo again - If anyone's interested, I've managed to setup the picture step of the checkout process to preview and delete the images if necessary during the checkout process rather than have to modify it after the fact. The code to change in usercheckout.php is basically a complete replacement of the ' case "5" ' section of the file. Actually it was a little confusing since to the user, this is step 4 of the process, but in the script it's actually step 5, so that can be a bit tricky. Anyways, here's the code for that file if anyone is interested:

The first thing you'll need to do is find this line (it's around line 20):

Code:
require_once(FILESYSTEM_PATH .'includes/classes/images/class_resize.php');
Directly below that code, insert this code as it's shown here:

Code:
require_once(FILESYSTEM_PATH .'/includes/classes/kernel/Listings.php');
$Listings=new Listings( $db );
We then need to replace the entire ' case "5" ' step to add the extra variables to the template as well as handle the deletion option:

Code:
case "5":
    //check if they want to delete a photo they've started uploading		  
	if(isset($_REQUEST['imageid']) && isset($_REQUEST['action']) && $_REQUEST['action']=="delete")
	{
	    $listingid=(int)@$_REQUEST['listingid'];
	    $imageid=(int)@$_REQUEST['imageid'];
	    
		if($Listings->removeOneImage($imageid))
		{
			header("Location: usercheckout.php?step=5&listingid=".$listingid);
			exit;
		}
		else
		{
		     echo LANG_ERROR;
		     exit;
		}
	}
      		    
	//image upload and insert
	getImageSettings();
	$listingid=(int)@$_REQUEST['listingid'];
	$upphotos=0;
	//first get image settings
	$sSQL="SELECT component,extensions,quality,maxWidth,maxHeight,maxWidthThumb,maxHeightThumb,qualityThumb,maxSize FROM ".PREFIX."image_settings WHERE id=1";
	$result=$db->query($sSQL);
	$rs=$result->fetch();
	$component=$rs['component'];
	$extensions=$rs['extensions'];
	$maxWidth=$rs['maxWidth'];
	$maxHeight=$rs['maxHeight'];
	$maxWidthThumb=$rs['maxWidthThumb'];
	$maxHeightThumb=$rs['maxHeightThumb'];
	$quality=$rs['quality'];
	$qualityThumb=$rs['qualityThumb'];
	$maxSize=$rs['maxSize'];
	$referer="usercheckout.php?step=5&listingid=".$listingid;

	//now upload it
	if(isset($_GET['upload']))
	{
	#$DMX_debug = true; //uncomment for debugging
	$ppu = new pureFileUpload();
	$ppu->path = "photos";
	$ppu->extensions = $extensions;
	$ppu->formName = "imageupload";
	$ppu->storeType = "file";
	$ppu->sizeLimit = $maxSize;
	$ppu->nameConflict = "uniq";
	$ppu->requireUpload = "true";
	$ppu->minWidth = "";
	$ppu->minHeight = "";
	$ppu->maxWidth = "";
	$ppu->maxHeight = "";
	$ppu->saveWidth = "";
	$ppu->saveHeight = "";
	$ppu->timeout = "600";
	$ppu->progressBar = "fileCopyProgress.php";
	$ppu->progressWidth = "300";
	$ppu->progressHeight = "100";
	$ppu->checkVersion("2.1.2");
	$ppu->referer = $referer;
	$ppu->doUpload();

	$sip = new resizeUploadedFiles($ppu);
	$sip->component = $component;
	$sip->resizeImages = "true";
	$sip->aspectImages = "true";
	$sip->maxWidth = $maxWidth;
	$sip->maxHeight = $maxHeight;
	$sip->quality = $quality;
	$sip->makeThumb = "true";
	$sip->pathThumb = "thumbs";
	$sip->aspectThumb = "true";
	$sip->naming = "prefix";
	$sip->suffix = "small_";
	$sip->maxWidthThumb = $maxWidthThumb;
	$sip->maxHeightThumb = $maxHeightThumb;
	$sip->qualityThumb = $qualityThumb;
	$sip->checkVersion("1.0.3");
	$sip->doResize();
	}
	//now insert it
	$rank=$_POST['upphotos']+1;
	$sSQL = sprintf("INSERT INTO ".PREFIX."prodimages (pid, title, image, rank) VALUES (%s, %s, %s, %s)",
		GetSQLValueString($_POST['listingid'], "text"),
		GetSQLValueString($_POST['title'], "text"),
		GetSQLValueString($_POST['imagename'], "text"),
		GetSQLValueString($rank, "text"));
	$db->query($sSQL);
	if($db->isError()) 
	{
		//error
		$class_tpl->assign('body','checkout/step6.tpl.php');
	}
	else
	{
		//get the product id
		$sSQL = "SELECT oPackageID FROM ".PREFIX."orders WHERE oProductID=".$listingid;
		$result=$db->query($sSQL);
		$rs=$result->fetch();
		$prodID=$rs['oPackageID'];

		//get the total number of images
		$sSQL = "SELECT images,numimages FROM ".PREFIX."cartproducts WHERE id=".$prodID;
		$result=$db->query($sSQL);
		$rs=$result->fetch();
		$images=$rs['images'];
		$numimages=$rs['numimages'];

		//get the number they have submitted
		$sSQL="SELECT id FROM ".PREFIX."prodimages WHERE pid=".$listingid;
		$result=$db->query($sSQL);
		$rs=$result->fetch();
		$upphotos=$result->size();
		
		if ($upphotos <> 0) {
			
		//Load all if any photos
		$sSQL="SELECT id, title, image FROM ".PREFIX."prodimages WHERE pid=".$listingid;
		$result=$db->query($sSQL);
 	  	    while ($rs=$result->fetch())
        {   
            $image_data = array('id'=>$rs['id'],'title'=>safeStripSlashes($rs['title']),'image'=>$rs['image']);
            
            $uploaded_images[]=$image_data;
	    }
	    
        }
        
		if($images<>"Y")
		{
			//this package doesn't allow photos. Lets redirect
			//or they have submitted the maximum number
			header("Location: usercheckout.php?step=6&listingid=".$listingid);
			exit;
		}
		else
		{
			//set placeholder count for image
	        $blank_photo = $numimages - $upphotos;
	        
			//they can add more photos.  
			//show the form again
			$placed_text=sprintf(LANG_YOU_HAVE_PLACED, $upphotos, $numimages);
			$class_tpl->assign('uploaded_images', $uploaded_images);
			$class_tpl->assign('blank_photo', $blank_photo);
			$class_tpl->assign('placed_text', $placed_text);
			$class_tpl->assign('listingid', $listingid);
			$class_tpl->assign('upphotos', $upphotos);
			$class_tpl->assign('numimages', $numimages);
			$class_tpl->assign('extensions', $extensions);
			$class_tpl->assign('maxSize', $maxSize);
			$class_tpl->assign('body','checkout/step4.tpl.php');
		}
	}
break;
You will then need to open your template file "step4.tpl.php" in the "checkout" folder and add this code to it to display the images and options:

Code:
<table width="100%" cellspacing="0" cellpadding="5">
          <tr>
            <td class="formstrip" align="center" colspan="{$numimages}">{$placed_text}<br></td>
          </tr>

          <tr>

          <!-- Show images that are uploaded -->
          {if isset($uploaded_images)}
          {counter start=0 skip=1 print=no assign=image_count}
			{foreach from=$uploaded_images item="entry"}
			{counter}
                <td><img src="photos/{$entry.image}" border="0" width="75" /><br><div align="center"><a href="usercheckout.php?step=5&imageid={$entry.id}&action=delete&listingid={$listingid}">Delete</a></div></td>
            {/foreach}
          {/if}
          
          <!-- Show placeholders for number of images left in package -->
          {if isset($upphotos)}
            {section name=photos loop=$blank_photo}
	          <td><img src="templates/{$smarty.const.MAIN_TEMPLATE}/images/little_photo.jpg" border="0" /></td>
	        {/section}
	      {else}
            {section name=photos loop=$numimages}
	          <td><img src="templates/{$smarty.const.MAIN_TEMPLATE}/images/little_photo.jpg" border="0" /></td>
	        {/section}
		  {/if}
	      </tr>
	      
	    </table>
For anyone that needs it, I've attached the "little_photo.jpg" placeholder image to this post.

I hope that helps someone out - it definitely makes the checkout process ALOT friendlier and hopefully will help stop people backing out half way through due to frustration.

Sorry if the code looks a little weird - the post editor has spaced it out all weirdly. If you copy and paste directly from here it'll be OK
Attached Images
File Type: jpg little_photo.jpg (571 Bytes, 113 views)
__________________
Thanks,

George

V3.1.5b Developer

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

Do you smell it? That smell. A kind of smelly smell. The smelly smell that smells ... smelly.

-Mr. Krabs
Reply With Quote
  #3  
Old 05-30-2007, 03:32 AM
Digbydo's Avatar
Junior Member
 
Join Date: Apr 2007
Location: Lancashire, UK
Posts: 15
Rep Power: 7
Digbydo is on a distinguished road
Thumbs up

Excellent !!

Many thanks for this
__________________
Dave
v3.1.7 Developer
Reply With Quote
  #4  
Old 05-31-2007, 01:13 AM
SkGold's Avatar
Senior Member
 
Join Date: Mar 2006
Location: Best city in the World – Calgary, Canada
Posts: 465
Rep Power: 22
SkGold has a spectacular aura about
Thumbs up

Very nice addition for checkout. Thanks a lot.

I have one question.
I allowed uploading 12 pictures and it makes the page very, very wide.
Is it possible to break the line and move the rest of the pictures to the next line, let say after every 4th picture? If yes, how can I do it?

Thanks in advance. Highly appreciated.
__________________
Thanks,
Sergey

Bargain Finder in Calgary, Alberta, Canada.
Calgary Business Directory V3.1.10 Dev - Calgary Classifieds V3.1.10 Dev - Calgary Real Estate V3.1.10 Dev - Calgary Used Cars V3.1.10 Dev - Calgary Rent V3.1.10 Dev - Calgary Dating V3.1.5 Dev

A website without well-done Internet Marketing and Search Engine Optimization is as good as non-existent.
Reply With Quote
  #5  
Old 06-01-2007, 12:59 AM
SkGold's Avatar
Senior Member
 
Join Date: Mar 2006
Location: Best city in the World – Calgary, Canada
Posts: 465
Rep Power: 22
SkGold has a spectacular aura about
Default

Quote:
Originally Posted by SkGold View Post
Is it possible to break the line and move the rest of the pictures to the next line, let say after every 4th picture? If yes, how can I do it?
I was trying to change
HTML Code:
{html_table_adv loop=$data cols=4 table_attr='width="100%"'}
instead of
HTML Code:
<table width="100%" cellspacing="0" cellpadding="5">
but getting error:
Quote:
Warning: Smarty error: html_table_adv: missing 'loop' parameter in ……../includes/classes/smarty/Smarty.class.php on line 1095
Could somebody please help how I can define this loop and where?
__________________
Thanks,
Sergey

Bargain Finder in Calgary, Alberta, Canada.
Calgary Business Directory V3.1.10 Dev - Calgary Classifieds V3.1.10 Dev - Calgary Real Estate V3.1.10 Dev - Calgary Used Cars V3.1.10 Dev - Calgary Rent V3.1.10 Dev - Calgary Dating V3.1.5 Dev

A website without well-done Internet Marketing and Search Engine Optimization is as good as non-existent.
Reply With Quote
  #6  
Old 06-03-2007, 09:56 PM
ginggs's Avatar
Junior Member
 
Join Date: Mar 2007
Posts: 20
Rep Power: 8
ginggs is on a distinguished road
Default

Hi Sergey,

With regards to the thumbnails spilling into a new line, all I did is use a class in the stylesheet associated with my template, as follows:

Code:
.img_thumbs {
	width: 700px;
	overflow: visible;
}
You can then choose the width of your image area in pixels and any images breaking the right hand side of this area, should overflow into a new row - if you have a look at our site - www.totallyclassifieds.com.au, you'll see that in any of the listings, especially the caravan ones, there's quite often more than one row of thumbnails in the "More Images" section at the bottom of the listing.
__________________
Thanks,

George

V3.1.5b Developer

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

Do you smell it? That smell. A kind of smelly smell. The smelly smell that smells ... smelly.

-Mr. Krabs
Reply With Quote
  #7  
Old 10-25-2008, 06:34 PM
Junior Member
 
Join Date: Nov 2006
Posts: 1
Rep Power: 0
alangreg is on a distinguished road
Red face works fine accept for image count set in admin

Thanks For This Mod,the thumbnail works fine accept for when you choose upload images,When Admin is set to say to allow 3 images package etc it tends to count two more and then will jump to the next step.I have tried so many ways allowing one image upload in the admin,but tthree can be uploaded and shown,finally the no image package set in admin works as it misses the step4 templateI have tried uploading all the files again but still the same i uploaded the original usercheckout.php and left step4.tpl and the images count to three then the next step works
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom checkout templates? Mike-N-Tosh v3.1 Modules & Modifications 3 04-02-2007 09:32 AM
Confused about checkout process steps. BigOrange v3.1 Questions & Support 7 10-04-2006 03:55 PM
Mod for checkout and admin control DVM v3.0 Questions & Support 0 08-22-2006 08:28 AM
Checkout - Step X of X civ v3.1 Suggestions and Feedback 1 05-09-2006 05:01 PM


All times are GMT -4. The time now is 05:22 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22