Forums / Setting Up Categories, Products, Attributes / Customer Upload Artwork Facility

Customer Upload Artwork Facility

Views: 33,678

Results 61 to 80 of 85
18 Sep 2009, 8:23 AM
#61
rohitsax avatar

rohitsax

New Zenner

Join Date:
May 2006
Posts:
33
Plugin Contributions:
0

Customer Upload Artwork Facility

duduint:

Hey rohitsax,

How can I create that file attribute to show in the cart with a preview and a link?

Dave

Well here's how it was done - you'll need to know PHP...

  1. First define the Option for uploading a picture in the attributes section. Lets say this is called 'Picture'.
  2. EDIT tpl_shopping_cart_default.php in the templates directory
    there's a line there...
    foreach ($product['attributes'] as $option => $value)

In this loop you need to check if the products option name is 'Picture'.

If the option is 'Picture' then show the image instead of writing the option.

The image itself is stored in the images/uploads directory. You will need to delete the htaccess file there because that prevents any uploaded file from showing up anywhere.

28 Sep 2009, 5:09 PM
#62
worbobnairb avatar

worbobnairb

New Zenner

Join Date:
Aug 2009
Posts:
7
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

Rohitsax or anybody who has done this,
could you please paste your tpl file for me. I am not familiar with php but need to allow customer's uploaded images to display in shopping cart. Please.

1 Oct 2009, 4:58 PM
#63
worbobnairb avatar

worbobnairb

New Zenner

Join Date:
Aug 2009
Posts:
7
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

Can somebody please tell me what I could switch the highlighted portion to in order to make the customer's uploaded image appear where the product image usually does? This is code from the tpl_shopping_cart_default.php. I need help.

<td class="cartProductDisplay"> <a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back">**<?php echo $product['productsImage']; ?>**</span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a> <br class="clearBoth" />
9 Oct 2009, 12:17 PM
#64
rohitsax avatar

rohitsax

New Zenner

Join Date:
May 2006
Posts:
33
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

The thumbnail is actually displayed below the product in the list of options. So I'm assuming you've got the attribute setup already to upload a picture. Lets say it's called 'Picture'

Now change the code here

	foreach ($product['attributes'] as $option => $value) {

check if the options is an image...

		$imagecheck = split(':', $value['products_options_name']);
		$optionvalue = nl2br($value['products_options_values_name']);
		$originalimage = split(' ', $optionvalue);
		$extensioncheck = split('[.]', $originalimage[1]);

		if ($imagecheck[0] == 'Picture') { 		
			echo '<a href="http://www.excitinglives.com/experience/images/uploads/'.$originalimage[0].$extensioncheck[1].'" target="_blank"><img src="http://www.excitinglives.com/experience/images/uploads/'.$originalimage[0].$extensioncheck[1].'" style="border:0px;width:170px;" ></a>'; 
		}
		else 
		{
			echo $value['products_options_name'] . ': <i>' . $optionvalue;
		}

There's other bits and pieces of code in there that is irrelevant here so its been taken out. YOu may have to modify some stuff yourself.

12 Oct 2009, 8:08 PM
#65
worbobnairb avatar

worbobnairb

New Zenner

Join Date:
Aug 2009
Posts:
7
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

Rohitsax,
Thank you so much. Everyone seems to need this function, but gets very little support help.

15 Oct 2009, 3:46 AM
#66
Join Date:
Oct 2009
Posts:
3
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

This code was super helpful. I am using it and it works like a charm except for one thing I was hoping someone could help with. If you upload a file with a space in the name like "filename 004.jpg" and zen renames to say 1.jpg, when it puts the img src code in, it only calls "1." and leaves the jpg off. I am an average user of scripting but know nothing about php and can't figure out a check in the code to correc this. Any help. I have included the actual html code from an example

<input type="hidden" name="id[4:6457c8c71463f156692aade2aa148fdb][3]" value="15" /><input type="hidden" name="id[4:6457c8c71463f156692aade2aa148fdb][txt_5]" value="sdafsda" /><input type="hidden" name="id[4:6457c8c71463f156692aade2aa148fdb][txt_10]" value="25. costume 1.jpg" /><div class="cartAttribsList"><ul>Font: <i>Font 1

<li>Font - Font 1</li>

Text: <i>sdafsda

<li>Text - sdafsda</li>

<a href="http://www.everlastingthings.com/zen/images/uploads/25." target="_blank"><img src="http://www.everlastingthings.com/zen/images/uploads/25." style="border:0px;width:170px;" ></a>

<li>File - 25. costume 1.jpg</li>
30 Oct 2009, 1:12 PM
#67
milenko avatar

milenko

New Zenner

Join Date:
Oct 2009
Posts:
2
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

I have added the code posted to my tpl_shopping_cart_default.php, the image shows up as the dreadful red x's. Here is a copy of my tpl_shopping_cart_default.php:

<?php
/**
 * Page Template
 *
 * Loaded automatically by index.php?main_page=shopping_cart.<br />
 * Displays shopping-cart contents
 *
 * @package templateSystem
 * @copyright Copyright 2003-2007 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_shopping_cart_default.php 5554 2007-01-07 02:45:29Z drbyte $
 */
?>
<div class="centerColumn" id="shoppingCartDefault">
<?php
  if ($flagHasCartContents) {
?>

<?php
  if ($_SESSION['cart']->count_contents() > 0) {
?>
<div class="forward"><?php echo TEXT_VISITORS_CART; ?></div>
<?php
  }
?>

<h1 id="cartDefaultHeading"><?php echo HEADING_TITLE; ?></h1>

<?php if ($messageStack->size('shopping_cart') > 0) echo $messageStack->output('shopping_cart'); ?>

<?php echo zen_draw_form('cart_quantity', zen_href_link(FILENAME_SHOPPING_CART, 'action=update_product')); ?>
<div id="cartInstructionsDisplay" class="content"><?php echo TEXT_INFORMATION; ?></div>

<?php if (!empty($totalsDisplay)) { ?>
  <div class="cartTotalsDisplay important"><?php echo $totalsDisplay; ?></div>
  <br class="clearBoth" />
<?php } ?>

<?php  if ($flagAnyOutOfStock) { ?>

<?php    if (STOCK_ALLOW_CHECKOUT == 'true') {  ?>

<div class="messageStackError"><?php echo OUT_OF_STOCK_CAN_CHECKOUT; ?></div>

<?php    } else { ?>
<div class="messageStackError"><?php echo OUT_OF_STOCK_CANT_CHECKOUT; ?></div>

<?php    } //endif STOCK_ALLOW_CHECKOUT ?>
<?php  } //endif flagAnyOutOfStock ?>

<table  border="0" width="100%" cellspacing="0" cellpadding="0" id="cartContentsDisplay">
     <tr class="tableHeading">
        <th scope="col" id="scQuantityHeading"><?php echo TABLE_HEADING_QUANTITY; ?></th>
        <th scope="col" id="scUpdateQuantity"> </th>
        <th scope="col" id="scProductsHeading"><?php echo TABLE_HEADING_PRODUCTS; ?></th>
        <th scope="col" id="scUnitHeading"><?php echo TABLE_HEADING_PRICE; ?></th>
        <th scope="col" id="scTotalHeading"><?php echo TABLE_HEADING_TOTAL; ?></th>
        <th scope="col" id="scRemoveHeading"> </th>
     </tr>
         <!-- Loop through all products /-->
<?php
  foreach ($productArray as $product) {
?>
     <tr class="<?php echo $product['rowClass']; ?>">
       <td class="cartQuantity">
<?php
  if ($product['flagShowFixedQuantity']) {
    echo $product['showFixedQuantityAmount'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
  } else {
    echo $product['quantityField'] . '<br /><span class="alert bold">' . $product['flagStockCheck'] . '</span><br /><br />' . $product['showMinUnits'];
  }
?>
       </td>
       <td class="cartQuantityUpdate">
<?php
  if ($product['buttonUpdate'] == '') {
    echo '' ;
  } else {
    echo $product['buttonUpdate'];
  }
?>
       </td>
       <td class="cartProductDisplay">
<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage" class="back"><?php echo $product['productsImage']; ?></span><span id="cartProdTitle"><?php echo $product['productsName'] . '<span class="alert bold">' . $product['flagStockCheck'] . '</span>'; ?></span></a>
<br class="clearBoth" />


<?php
  echo $product['attributeHiddenField'];
  if (isset($product['attributes']) && is_array($product['attributes'])) {
  echo '<div class="cartAttribsList">';
  echo '<ul>';
    reset($product['attributes']);
    foreach ($product['attributes'] as $option => $value) {
$imagecheck = split(':', $value['products_options_name']);
$optionvalue = nl2br($value['products_options_values_name']);
$originalimage = split(' ', $optionvalue);
$extensioncheck = split('[.]', $originalimage[1]);

if ($imagecheck[0] == 'Picture') { 
echo '<a href="http://DOMAIN.COM/zencart/images/uploads/'.$originalimage[0].$extensioncheck[1].'" target="_blank"><img src="http://DOMAIN.COM/zencart/images/uploads/'.$originalimage[0].$extensioncheck[1].'" style="border:0px;width:170px;" ></a>'; 
}
else 
{
echo $value['products_options_name'] . ': <i>' . $optionvalue;
}

?>

<li><?php echo $value['products_options_name'] . TEXT_OPTION_DIVIDER . nl2br($value['products_options_values_name']); ?></li>

<?php
    }
  echo '</ul>';
  echo '</div>';
  }
?>
       </td>
       <td class="cartUnitDisplay"><?php echo $product['productsPriceEach']; ?></td>
       <td class="cartTotalDisplay"><?php echo $product['productsPrice']; ?></td>
       <td class="cartRemoveItemDisplay">
<?php
  if ($product['buttonDelete']) {
?>
           <a href="<?php echo zen_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&product_id=' . $product['id']); ?>"><?php echo zen_image($template->get_template_dir(ICON_IMAGE_TRASH, DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . ICON_IMAGE_TRASH, ICON_TRASH_ALT); ?></a>
<?php
  }
  if ($product['checkBoxDelete'] ) {
    echo zen_draw_checkbox_field('cart_delete[]', $product['id']);
  }
?>
</td>
     </tr>
<?php
  } // end foreach ($productArray as $product)
?>
       <!-- Finished loop through all products /-->
      </table>

<div id="cartSubTotal"><?php echo SUB_TITLE_SUB_TOTAL; ?> <?php echo $cartShowTotal; ?></div>
<br class="clearBoth" />

<!--bof shopping cart buttons-->
<div class="buttonRow forward"><?php echo '<a href="' . zen_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . '</a>'; ?></div>
<div class="buttonRow back"><?php echo zen_back_link() . zen_image_button(BUTTON_IMAGE_CONTINUE_SHOPPING, BUTTON_CONTINUE_SHOPPING_ALT) . '</a>'; ?></div>
<?php
// show update cart button
  if (SHOW_SHOPPING_CART_UPDATE == 2 or SHOW_SHOPPING_CART_UPDATE == 3) {
?>
<div class="buttonRow back"><?php echo zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT); ?></div>
<?php
  } else { // don't show update button below cart
?>
<?php
  } // show update button
?>
<!--eof shopping cart buttons-->
</form>

<br class="clearBoth" />
<?php
    if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '1') {
?>

<div class="buttonRow back"><?php echo '<a href="javascript:popupWindow(\'' . zen_href_link(FILENAME_POPUP_SHIPPING_ESTIMATOR) . '\')">' .
 zen_image_button(BUTTON_IMAGE_SHIPPING_ESTIMATOR, BUTTON_SHIPPING_ESTIMATOR_ALT) . '</a>'; ?></div>
<?php
    }
?>

<!-- ** BEGIN PAYPAL EXPRESS CHECKOUT ** -->
<?php  // the tpl_ec_button template only displays EC option if cart contents >0 and value >0
if (defined('MODULE_PAYMENT_PAYPALWPP_STATUS') && MODULE_PAYMENT_PAYPALWPP_STATUS == 'True') {
  include(DIR_FS_CATALOG . DIR_WS_MODULES . 'payment/paypal/tpl_ec_button.php');
}
?>
<!-- ** END PAYPAL EXPRESS CHECKOUT ** -->

<?php
      if (SHOW_SHIPPING_ESTIMATOR_BUTTON == '2') {
/**
 * load the shipping estimator code if needed
 */
?>
      <?php require(DIR_WS_MODULES . zen_get_module_directory('shipping_estimator.php')); ?>

<?php
      }
?>
<?php
  } else {
?>

<h2 id="cartEmptyText"><?php echo TEXT_CART_EMPTY; ?></h2>

<?php
$show_display_shopping_cart_empty = $db->Execute(SQL_SHOW_SHOPPING_CART_EMPTY);

while (!$show_display_shopping_cart_empty->EOF) {
?>

<?php
  if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_FEATURED_PRODUCTS') { ?>
<?php
/**
 * display the Featured Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php'); ?>
<?php } ?>

<?php
  if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_SPECIALS_PRODUCTS') { ?>
<?php
/**
 * display the Special Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?>
<?php } ?>

<?php
  if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_NEW_PRODUCTS') { ?>
<?php
/**
 * display the New Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
<?php } ?>

<?php
  if ($show_display_shopping_cart_empty->fields['configuration_key'] == 'SHOW_SHOPPING_CART_EMPTY_UPCOMING') {
    include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS));
  }
?>
<?php
  $show_display_shopping_cart_empty->MoveNext();
} // !EOF
?>
<?php
  }
?>
</div>

Location: /includes/templates/template_default/templates

It would be awesome if someone could post thier tpl_shopping_cart_default.php and that way people would only need to edit the domain address in the new code?
Any help would be appreciated!

30 Oct 2009, 1:21 PM
#68
milenko avatar

milenko

New Zenner

Join Date:
Oct 2009
Posts:
2
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

Nevermind the code works, make sure to delete the htaccess file in the upload folder!

21 Nov 2009, 10:57 PM
#69
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

I have done a test as customer upload an image file why I am not recieving the attachment in my email?

21 Nov 2009, 11:45 PM
#70
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

I have done everything of what Ahej said. But I can't get my image after they have uploaded the image(s). How can get my images?

21 Nov 2009, 11:48 PM
#71
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

Ajeh:

Options Name Manager ...
Option Name: Logo
Option Type: File

Option Value Manager ...
NOTE: You do not add anything for the Option Value

Attributes Controller ...
Locate Product for Upload
Option Name: Logo
Option Value: TEXT [RESERVED FOR TEXT/FILES ONLY ATTRIBUTES]

Files will be uploaded to:
/images/uploads

They will be labled by number.ext and match what is in the Orders information of the Admin ...

I have everything set like it should but I am unable to pull the image.

22 Nov 2009, 1:40 AM
#72
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Customer Upload Artwork Facility

The image uploaded is on your server in the directory /images/uploads

The image filename has been renamed such as 1.jpg 2.gif 3.jpg and is listed on the order details in your Admin ...

You can download the images via FTP ...

The original name is next to the numbered filename ...

NOTE: while the numbers appear to match the orders_id this is an illusion ... that only appears to be what is happening ... this is not the case, it is just the next number in sequence ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

22 Nov 2009, 1:42 AM
#73
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

Oh ok, Gotcha.

12 Jul 2010, 11:18 AM
#74
lovingexpress avatar

lovingexpress

New Zenner

Join Date:
Jul 2010
Location:
Spokane, WA
Posts:
25
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

ok this is what I've been searching for but with the new version we don't HAVE an "options" LOL how do we do it now?

"With hurricanes, tornadoes, fires out of control, mud slides, and flooding tearing up the country, and with the threat of bird flu and terrorist attacks, "Are we sure this is a good time to take God out of the Pledge of Allegiance?"

12 Jul 2010, 11:24 AM
#75
lovingexpress avatar

lovingexpress

New Zenner

Join Date:
Jul 2010
Location:
Spokane, WA
Posts:
25
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

UGG!! that thread is an older version of zen cart and now we don't have the "option" menu! Does it still do it? can someone help me understand the needed change? :)

"With hurricanes, tornadoes, fires out of control, mud slides, and flooding tearing up the country, and with the threat of bird flu and terrorist attacks, "Are we sure this is a good time to take God out of the Pledge of Allegiance?"

15 Jul 2010, 4:08 AM
#76
jazzah avatar

jazzah

Zen Follower

Join Date:
Jun 2007
Posts:
104
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

Ok after spending 20 m inutes seraching for an option ment, now I see that we dont have one anymore. We need customers to upload images to print on edible cake image sheets. How can we do this? Thanks

15 Jul 2010, 9:46 AM
#77
lovingexpress avatar

lovingexpress

New Zenner

Join Date:
Jul 2010
Location:
Spokane, WA
Posts:
25
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

jazzah:

Ok after spending 20 m inutes seraching for an option ment, now I see that we dont have one anymore. We need customers to upload images to print on edible cake image sheets. How can we do this? Thanks

http://www.zen-cart.com/forum/showthread.php?t=113761 :clap:

"With hurricanes, tornadoes, fires out of control, mud slides, and flooding tearing up the country, and with the threat of bird flu and terrorist attacks, "Are we sure this is a good time to take God out of the Pledge of Allegiance?"

19 Jan 2011, 10:49 AM
#78
simona avatar

simona

New Zenner

Join Date:
Jan 2011
Posts:
6
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

Hi, everyone!
First of all, great job everyone! Zen Cart is amazing and the support we get on the forums is pure gold.
Now, I find myself in need of some help too. I modified the tpl_shopping_cart_default.php as instructed and managed to get the picture to appear, but unfortunately only in the English version of the site. My site has also Greek language and there I cannot get the picture to display. What am I missing?

31 Jan 2011, 4:07 PM
#79
simona avatar

simona

New Zenner

Join Date:
Jan 2011
Posts:
6
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

rohitsax:

The thumbnail is actually displayed below the product in the list of options. So I'm assuming you've got the attribute setup already to upload a picture. Lets say it's called 'Picture'

Now change the code here

  foreach ($product['attributes'] as $option => $value) {

check if the options is an image...

  	$imagecheck = split(':', $value['products_options_name']);
  	$optionvalue = nl2br($value['products_options_values_name']);
  	$originalimage = split(' ', $optionvalue);
  	$extensioncheck = split('[.]', $originalimage[1]);

  	if ($imagecheck[0] == 'Picture') { 		
  		echo '<a href="http://www.excitinglives.com/experience/images/uploads/'.$originalimage[0].$extensioncheck[1].'" target="_blank"><img src="http://www.excitinglives.com/experience/images/uploads/'.$originalimage[0].$extensioncheck[1].'" style="border:0px;width:170px;" ></a>'; 
  	}
  	else 
  	{
  		echo $value['products_options_name'] . ': <i>' . $optionvalue;
  	}

I found the answer to my own question and I will post here the answer in case anyone will ever need it. When you have two languages, the attributes have two names, one for each language so you should perform a check for both attribute names like so:

if ($imagecheck[0] == 'Picture' or $imagecheck[0]=="[I]Name of attribute in secondlanguage[/I]"))

Now the new trouble I have is caused by spaces in the file name. If there is a space in the file name (something like "img 003.jpg") then it will not work. I see the same question asked in post #66..can I please have a solution?

31 Jan 2011, 6:33 PM
#80
simona avatar

simona

New Zenner

Join Date:
Jan 2011
Posts:
6
Plugin Contributions:
0

Re: Customer Upload Artwork Facility

Ok, I will reply to myself again, still hoping some day some beginner (like me) will benefit.

So, the above code has to be modified like this

$originalimage = split(' ',$optionvalue,2);

Notice the 2 i added after $optionvalue. This will split correctly into just two strings the $originalimage. (for further info, look up the split function).

Also, since I need to have more products that have file uploads as attributes, instead of making a check for the attribute name, I chose to test the extension like so:

if ($extensioncheck[1] == 'jpg' or or $extensioncheck[1]=='gif' or $extensioncheck[1]=='png')

insted of

if ($imagecheck[0] == 'Picture' or $imagecheck[0]=="Name of attribute in secondlanguage"))

The other file types are not included cause they cannot be displayed anyway