WP-E-Commerce Tip: Change the path to the add to cart image

You’re using the theme named iShop.
You’ve moved your themes to the /wp-content/uploads/wpsc directory.
Now you want to get the add to cart image from /wp-content/uploads/wpsc/iShop instead of /wp-content/plugins/wp-e-commerce/themes/iShop
Once this is done, upgrading the plugin won’t get rid of your add to cart image.

products_page.php /wp-content/uploads/wpsc/themes/iShop/products_page.php
Please backup your files before editing!

Find lines 231 to 233

[php]
<?php else: ?>
<input type=’image’ src='<?php echo WPSC_URL; ?>/themes/iShop/images/buy_button.gif’
id=’product_<?php echo wpsc_the_product_id(); ?>_submit_button’
class=’wpsc_buy_button’ name=’Buy’ value="<?php echo __(‘Add To Cart’, ‘wpsc’); ?>" />
<?php endif; ?>[/php]

Change to:

[php]
<?php else: ?>
<?php $upload_dir = wp_upload_dir(); ?>
<input type=’image’ src='<?php echo $upload_dir[‘baseurl’];?>
/wpsc/themes/iShop/images/buy_button.gif’
id=’product_<?php echo wpsc_the_product_id(); ?>_submit_button’
class=’wpsc_buy_button’ name=’Buy’ value="<?php echo __(‘Add To Cart’, ‘wpsc’); ?>" />
<?php endif; ?>[/php]

single_product.php
Find lines 180 to 183
[php]
<?php else: ?>
<input type=’image’ src='<?php echo WPSC_URL; ?>/themes/iShop/images/buy_button.gif’
id=’product_<?php echo wpsc_the_product_id(); ?>_submit_button’
class=’wpsc_buy_button’ name=’Buy’ value="<?php echo __(‘Add To Cart’, ‘wpsc’); ?>" />
<?php endif; ?>[/php]

Change to
[php]
<?php else: ?>
<?php $upload_dir = wp_upload_dir(); ?>
<input type=’image’ src='<?php echo $upload_dir[‘baseurl’];?>
/wpsc/themes/iShop/images/buy_button.gif’
id=’product_<?php echo wpsc_the_product_id(); ?>_submit_button’
class=’wpsc_buy_button’ name=’Buy’ value="<?php echo __(‘Add To Cart’, ‘wpsc’); ?>" />
<?php endif; ?>[/php]

Now all you have to do is upload your add to cart image to the images folder of your theme in your theme’s new location.
If you’re using a .png or .jpg image file type or an image with a different file name than buy_button.gif you have to make sure to edit the code to use the image file name or type.

Marketplace
products_page.php at lines 235 to 238
single_product.php at lines 182 to 184
Tip about the Marketplace theme: it uses atc.gif as the add to cart image, not buy_button.gif.

Default
Tip about the default theme: it uses input type=’submit’ instead of input type=’image’ which is what the 2 other themes use.
So if you’re already using some CSS to style the button I would leave this code alone since upgrading won’t affect your theme.
But if you want to use an image go ahead and edit the files:
products_page.php at lines 233 to 235
single_product.php at lines 179 to 181

New WP-E-Commerce Site Just Finished Today

This is for Tagsmith, a custom leather luggage tag maker in Los Angeles,CA. I’m going to be going on a trip soon myself (yay!) and it makes perfect sense to get a hot pink leather luggage tag for my bag so it will stand out amongst the kazillion other black bags on the baggage carousel…So check out his new site and buy some tags. Also that little plastic window that covers your address won’t turn yellow. Very important.

**Edit Alert** Wednesday, May 12

Turned out that was a premature announcement. After I posted this my client asked me to revise the design… It’s not uncommon to be asked for revisions and its not uncommon to miss the design mark on the first or second try. Luckily I got it right on the second try. Check out the results:

www.tagsmithoriginals.com

How To Add Introductory Paragraph Text To The Front Page Of The WP-Ecommerce Shop

And have it show only on the front page of the shop?

A client of mine asked if I could add an introductory/greeting kind of message to show to people looking at the front page of his online store. Sure thing, I said and I put it right in and went on my way thinking that was that. Later I realised that this blurb showed up everywhere on the shop. This is because the page with [ productspage ] in it is the same page for all the product pages. All full product lists and single product views get displayed with one little shortcode.

You also can’t put the paragraphs into the page template file for this page, or put it in a new file in the theme folder and include it in the page template because (again) that page runs the whole show. Back to square one. You could delve into the functions and make an “if on this page do this” statement (and for all you folks who can pull PHP out of their noses,congratulations) but I have always been more of a shove code around kind of person. So what I did was I found the line (line number 44) in the grid_display_functions.php file that displays the div that wraps the cart pages.

So after

[php]$output .= "<div class=’productdisplay $category_nice_name’>\n\r";[/php]

I added

[php]$output .="<div class=’blurbs’>my intro text</div>";[/php]

If you don’t have grid view you can still add an introductory blurb or welcome text or whatever to product_display_functions.php which is the file in charge of displaying the product list. Find line 333 (or find the first line in the file that writes the wrapper div for the shop pages) which is

[php]$output .= "<div class=’productdisplay default_product_display product_view_{$product[‘id’]} {$category_nice_name}’>";
//After line @ #333 add
$output .="<div class=’blurbs’>my intro text</div>";[/php]

Avoiding fatal error messages
Don’t use full quotes ” “ Normally you’d write

[html]<div class="code">[/html]

but you can’t because PHP is strict about that. Use single quotes instead

[html]<div class=’code’>[/html]

and escape your HTML Characters to be on the safe side. Example: an apostrophe is

[html]&#136;[/html]

So write

[html]don&#136;t[/html]

instead of don’t.

What About Upgrading?
Because you are adding to the file and not directly editing any code it will be easy to simply add it back in after the next upgrade. I keep a folder full of my changed plugin files so I can refer to them, grab the code and add it back, fast.

Google results: Results 1 – 10 of about 244,000,000 for welcome to my store.
Apart from the benefit of being able to introduce people to your products is it adds SEO to your shop page. Search engines love text with tasty keywords – so will you when you see your shop page climbing higher in the SERPs. Use well placed keywords in natural sentences that best describe your products or the overall message behind your products.So take care with the intro paragraph(s), don’t just say Welcome to my store that’s not only boring – it’s not going to help you in the SERPs. Most people are not searching for things to buy online or locally with the search terms welcome to my store.

shortcode = code in square brackets that can be inserted into a WordPress Page that includes a plugin in that page.
SEO = search engine optimization, sort of self explanatory.
SERPs = search engine result page(s).Also self explanatory.

Changed homepage_product_functions.php For WP Shopping Cart plugin 3.6.12

example of 3 product categories in one page
example of 3 product categories in one page

Revision!
When I was checking the file I noticed a few minor mistakes and un-needed HTML. I also wanted to show an example image from my shop which is installed on this website but is not in production,yet. The example image shows that I have inserted 3 product categories into a WordPress Page. This is not the default WPSC Products_Page but a new page I made just for this purpose. The products are displayed as if I had Grid View even though I deleted my Gold Cart files when I last upgraded to wpsc version 3.6.12 and never had Grid View installed on this server.

Changes to version 5 of my homepage_products_functions.php:
Removed div.goddamn
Replaced class=”product_image” with class=”center”
Removed div.clear
Removed a division id that would render pages invalid

Download the changed file here

[download id=”3″]

New CSS
.homepage_products{overflow:hidden;width:100%;position:relative;}
/* Adjust for your product images w+h & if using variations and want them visible in the product box*/
.homepage_products .category_view_product{position:relative;width:200px;height:205px;float:left;margin:8px 3px; text-align:center;}

/* styles the product title I’ve left it blank*/
.homepage_products a.wpsc_product_title{}

/* centers the product thumbnail image*/
.homepage_products .center{padding:4px;text-align:center;margin:0 auto;display:block}

/*styles the product price-I’ve left this blank*/
span.pricedisplay{}

Disclaimer

In case anybody cares I am not providing this file as a way to rob the plugin authors. The changes I have made to the file do not give you anything but a product thumbnail image that links to the single product page instead of to a thickbox pop up image. Buying the Gold Cart allows you to have more payment gateways,multiple product images and other great stuff.

The rest is all simple CSS and not using “full display” when inserting a wpsc category id into a Page or Post.

I myself have purchased the Gold Cart and have encouraged all my clients to purchase it as well. I fully support the WP-Ecommerce plugin authors. I began working on this file as a way to perfect SEO for shopping cart pages because being able to use one’s own WordPress Pages along with the venerable All In One SEO Pack plugin vastly improved the SEO for my client’s carts. Not to mention the fact that if they have Grid View they ought to be able to have Grid View site-wide not just on the plugin’s pages.