We've covered uploading multiple categories in wp-e-commerce, but what about images?
It stands to reason that if you are uploading a bunch of products, you will want images to accompany them. This takes a little more work than adding multiple categories, but is significantly easier than adding them one-by-one.
1. Preparing the Images
If you are happy doing bulk resizing/cropping in whichever graphics package you use, then do it! Process your product images so that you have a thumbnail that matches the size defined in your wp-e-commerce installation (96px X 96px is the current default).
Next process your source images again so that you have a large image that is either a manageable size, or sized to your wp-e-commerce product image size settings (128px X 128px is the current default). Once you have thumbnails and full-size images, upload the thumbnails to "wp-content/uploads/wpsc/product_images/thumbnails/" and the full-size to "wp-content/uploads/wpsc/product_images/". You can now move onto step 2 "Importing".
If you aren't happy batch-processing images you can create a directory called "'wp-content/uploads/wpsc/product_images/temp" and upload all your product images there. Please ensure that the images are at a manageable size (i.e. less than 1000px wide or high).
Next download and save a copy of the "imgprocess.php" script we cobbled together (remove the XXX from the extension) - n.b. this script is largely based on a great function here
Adjust the thumbnail size variables ($thumbwidth and $thumbheight) on lines 3-4 to correspond with the thumbnail sizes specified in wp-e-commerce (default is 96px X 96px). If you want your large images processed as well then add the relevant dimensions to the $largewidth and $largeheight variables on lines 6 and 7. Alternatively, leave them at 0 if you don't want to resize your large images. Please note that this is a basic script so it only crops images to the exact sizes specified. If you want your large images to be scaled, you will have to add that functionality yourself.
Once you have made your adjustments, upload the script to the root of your WordPress installation (in most cases yoursite.com/imgprocess.php). Please note that this script has not been extensively tested, and you run it very much at your own risk. We highly recommend running it in a test environment first and take no responsibility for anything (from server failure to hives or plagues of locusts) that occurs from the moment you run it!!
If you chose to continue, run the script by entering the location into your browser (in most cases yoursite.com/imgprocess.php). The script will take a while to execute, but all being well you will see a big ugly message saying "Images processed". Your thumbnails directory should now be populated with the thumbnails you created.
If you chose not to resize the large images then simply copy the images from "wp-content/uploads/wpsc/product_images/temp" to "wp-content/uploads/wpsc/product_images". Otherwise, your resized large images should be in wp-content/uploads/wpsc/product_images/'.
Next delete "wp-content/uploads/wpsc/product_images/temp" and delete imgprocess.php.
2. Importing
Open wp-e-commerce/wpsc-admin/includes/settings-pages/import.php
locate the option list:
Product Name
Description
...etc
and add the following option value:
Image
Next locate the line
$existing_name = get_product_meta($id, 'url_name');
and add the following above it so it reads:
$image_query = "INSERT INTO `".WPSC_TABLE_PRODUCT_IMAGES."` (product_id,image ) VALUES ('$id','".$cvs_data2."')";
$wpdb query($image_query);
$imageid = $wpdb get_var("SELECT LAST_INSERT_ID() as id FROM `".WPSC_TABLE_PRODUCT_IMAGES."`");
//now add image id to product
$image_query2 = "UPDATE `".WPSC_TABLE_PRODUCT_LIST."` SET image = ".$imageid." WHERE id=".$id;
$wpdb query($image_query2);
$existing_name = get_product_meta($id, 'url_name');
Now add a column to your product list csv that you wish to upload and add the name of each image uploaded to the relevant image
e.g.
SKU, Name, Price, Image
001, Shoe, 100, shoe.jpg
002, Hat, 20, hat.jpg
Upload the csv as normal remembering to assign 'Image' to the relevant column, and your products should now be loaded complete with images.
Mostrando entradas con la etiqueta ecommerce. Mostrar todas las entradas
Mostrando entradas con la etiqueta ecommerce. Mostrar todas las entradas
viernes, 28 de mayo de 2010
miércoles, 19 de mayo de 2010
wp-e-commerce upload adding multiple categories to CSV upload
How to bulk upload to more than one category with the excellent Wp-e-commerce plugin.
In our case, we needed to assign each product to a category and a brand (e.g. Category: Jeans, Brand: Levis). To do this, we removed the bulk 'add to category' dropdown from the bottom of the import page and added a category and brand option to the dropdowns that are used to assign columns in the uploaded .csv file. Here's how...
Open wp-e-commerce/wpsc-admin/includes/settings-pages/import.php
As we are going to assign each item to its own category and brand, the category dropdown at the bottom of the upload page is no longer relevant. So, we remove lines 77 - 85:
Please select a category you would like to place all products from this CSV into:
'.$category.'';
}
Next we add the category and brand options to the dropdown list of assignable fields.
lines 61 - 69 show:
Product Name
Description
Additional Description
Price
SKU
Weight
Weight Unit
Stock Quantity
Stock Quantity Limit
We are going to add to these so we now have:
Product Name
Description
Additional Description
Price
SKU
Weight
Weight Unit
Stock Quantity
Stock Quantity Limit
Category
Brand
now we change (what is now) line 122 - 123 to read:
$category_query = "INSERT INTO `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` VALUES ('','$id','".$cvs_data2."')";
$wpdb query($category_query);
and add the following two lines underneath:
$brand_query = "INSERT INTO `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` VALUES ('','$id','".$cvs_data2."')";
$wpdb query($brand_query);
This is simply adding the category and brand id to the WPSC_TABLE_ITEM_CATEGORY_ASSOC table.
Remember to add the Category IDs to your csv file and NOT the category name. Alternatively you could extend this tutorial by looking up the Category ID using the Category Name and inserting that.
In our case, we needed to assign each product to a category and a brand (e.g. Category: Jeans, Brand: Levis). To do this, we removed the bulk 'add to category' dropdown from the bottom of the import page and added a category and brand option to the dropdowns that are used to assign columns in the uploaded .csv file. Here's how...
Open wp-e-commerce/wpsc-admin/includes/settings-pages/import.php
As we are going to assign each item to its own category and brand, the category dropdown at the bottom of the upload page is no longer relevant. So, we remove lines 77 - 85:
Please select a category you would like to place all products from this CSV into:
'.$category.'';
}
Next we add the category and brand options to the dropdown list of assignable fields.
lines 61 - 69 show:
Product Name
Description
Additional Description
Price
SKU
Weight
Weight Unit
Stock Quantity
Stock Quantity Limit
We are going to add to these so we now have:
Product Name
Description
Additional Description
Price
SKU
Weight
Weight Unit
Stock Quantity
Stock Quantity Limit
Category
Brand
now we change (what is now) line 122 - 123 to read:
$category_query = "INSERT INTO `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` VALUES ('','$id','".$cvs_data2."')";
$wpdb query($category_query);
and add the following two lines underneath:
$brand_query = "INSERT INTO `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` VALUES ('','$id','".$cvs_data2."')";
$wpdb query($brand_query);
This is simply adding the category and brand id to the WPSC_TABLE_ITEM_CATEGORY_ASSOC table.
Remember to add the Category IDs to your csv file and NOT the category name. Alternatively you could extend this tutorial by looking up the Category ID using the Category Name and inserting that.
Etiquetas:
Content Management System (CMS),
ecommerce,
php,
wordpress
jueves, 14 de febrero de 2008
PayPal alternatives in South Africa
We have had a number of clients inquiring about selling low-volumes of product on their websites recently, exactly the kind of thing PayPal would be perfect for.
Sadly for our South African clients, this really isn't an option thanks to our good friends at SARS (the South African Revenue Service).
South African's can set up PayPal accounts. They can pay money from their South African bank accounts into their PayPal accounts and they can spend that money as they choose, but they can't transfer any money paid into their PayPal account back into their South African account.
So, if you sell something on your site the money paid into your PayPal account will be utterly useless to you (unless you intend to spend all that money on locks of Britney Spear's hair, or napkins used by Elvis).
Fortunately there are alternatives and two we've heard a lot of positive talk about recently are PayFast and Setcom.
PayFast is only in Beta at the moment, so you may wish to hold back for the final version before signing up. The fee structure is as follows:
R1 - R25 000 2.00%
R25 000 - R100 000 - 1.80%
R100 000 - R250 000 - 1.60%
R250 000 - R1 000 000 - 1.40%
Setcom have a range of fees depending on whether your customer is paying by credit/debit card, setcom account, or various other services, and they promise
"payments (that) are made in real-time, quicker than bank transfers, checks, or money orders".
Most importantly, neither service charge monthly, setup or signing fees. So, you pay as you earn (something that SARS would encourage no doubt!)
We are yet to make use of either service, but will review them as and when we do.
Sadly for our South African clients, this really isn't an option thanks to our good friends at SARS (the South African Revenue Service).
South African's can set up PayPal accounts. They can pay money from their South African bank accounts into their PayPal accounts and they can spend that money as they choose, but they can't transfer any money paid into their PayPal account back into their South African account.
So, if you sell something on your site the money paid into your PayPal account will be utterly useless to you (unless you intend to spend all that money on locks of Britney Spear's hair, or napkins used by Elvis).
Fortunately there are alternatives and two we've heard a lot of positive talk about recently are PayFast and Setcom.
PayFast is only in Beta at the moment, so you may wish to hold back for the final version before signing up. The fee structure is as follows:
R1 - R25 000 2.00%
R25 000 - R100 000 - 1.80%
R100 000 - R250 000 - 1.60%
R250 000 - R1 000 000 - 1.40%
Setcom have a range of fees depending on whether your customer is paying by credit/debit card, setcom account, or various other services, and they promise
"payments (that) are made in real-time, quicker than bank transfers, checks, or money orders".
Most importantly, neither service charge monthly, setup or signing fees. So, you pay as you earn (something that SARS would encourage no doubt!)
We are yet to make use of either service, but will review them as and when we do.
Suscribirse a:
Entradas (Atom)