Xsilva Web Store Tip:Get Product Price In Related Products Slider

If you’re into customizing the Xsilva LightSpeed Web Store you might find it handy to be able to make the way products are displayed in the slider more like the way they appear in your main product list and your Custom Pages. Over the years I’ve had lots of requests relating to redesigning the slider that shows on a Custom Page but not many of my clients actually use the slider that appears in the Product Details Page so I hadn’t really ever bothered with it. Right away I noticed the Related Products Slider shows the product code – not the price. It can be pretty ugly especially if your product codes look like “PGH-34rjd”. I can imagine this is useful for sites that sell machine parts but the average customer is probably not ever going to need to see the product code.

The first thing I did was look at the Related Products Slider code ( in product_detail.tpl.php starting @ line 114):

[php]<?php if(count($this->arrRelatedProducts)>0):?>
<?php $this->sldRelated->Render();?>
<?php endif; ?>[/php]

Then I compared it to the custom code I already had in the Custom Page Template :

[php]<?php if(isset($this->pnlSlider)):
foreach($this->pnlSlider->links as $ind=>$prod){
$this->pnlSlider->links[$ind][‘title2’]
= _xls_currency(Product::LoadByCode($prod[‘title2’])->Price);
}
$this->pnlSlider->Name = ”;
$this->pnlSlider->Render();
endif; ?>
[/php]

As you can see it was very easy to carry over into the Related Products Slider – since its practically the same, I only had to change the name of the slider.
From pnlSlider to sldRelated

Here is the final code:
[php]<?php
foreach($this->sldRelated->links as $ind=>$prod){
$this->sldRelated->links[$ind][‘title2’]
= _xls_currency(Product::LoadByCode($prod[‘title2’])->Price);
}
$this->sldRelated->Name = ”;
$this->sldRelated->Render();
endif; ?>[/php]

Maybe not incidentally, if you want to be able to get rid of the default title of the slider $this->sldRelated->Name = ”; will do that.
This way you can add your own heading HTML above the slider code. This will also stop the in-line styling and external CSS for the Slider Name kicking in. There’s nothing wrong with white text with CSS3 text-shadow. If it matches your design.

Example: [html]<h2>You Might Also Like</h2>[/html]

This is what the one I was working on looks like

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

In Which Netflix is mean to me and then I write about it

All of a sudden I couldn’t stream any Netflix titles instantly so I called their support line. Found out they put my account on hold December 30th. During our conversation, the operator said I wasn’t being punished and that they were just trying to find a way to make the service work for me because it wasn’t working if so many of their discs were going missing. You think? Well, why if it is a physical disc issue does my complete account have to be suspended? And why did it have to be suspended over the New Year weekend? Even Time Warner wouldn’t do that. I acknowledge the fact that I live on what might be one of the worst USPS mail routes in the USA in a building full of people who might or might not be “borrowing” my Netflix discs and never returning them. But to put someone’s account on hold over a holiday weekend is not very nice at all.

Of course I can’t prove that I’m not building quite a tidy DVD collection at Netflix’s expense. But if you were looking at my account history you’d see that I have returned all of these TV shows:

  • Mad Men:Season:2 (all discs),
  • The Wire:Season 5 (all discs),
  • Damages:Season 1 & 2 (all discs),
  • Jackie Woodman: Season 1 & 2 (all discs),
  • True Blood: Season 1 (all discs)
  • Squidbillies: Volumes 1 & 2 (all discs)

Film:

  • Frozen River,
  • The White Ribbon,
  • The Ghost Writer,
  • Five Easy Pieces,
  • The Secret in their Eyes,
  • The Hangover,
  • District 9,
  • The Hurt Locker,
  • Blindness,
  • 28 Days Later,
  • Black Book,
  • The Diving Bell and the Butterfly

Considering the fact that I gave all of these movies and shows at least a 4 star rating – why would I then keep a bad movie like Expired when I could have kept 28 Days Later, one of my all time favorite movies?

Even though I know it probably wasn’t a person with the power of logic in charge of putting my account on hold and that more likely a computer somewhere keeping track of my missing discs triggered the decision, I am still very much put out.

Normally I would try to spare my 4 subscribers from having to read this sort of of thing but Netflix doesn’t have a contactable email address and so now you have to know what happened,too.