3 replies [Last post]
wadehays's picture
Offline
Joined: 02/10/2008
Juice: 103
Was this information Helpful?

Here is some stuff I learned recently that may be useful to other site admins.

Apple does not allow its value added resellers to sell Apple products on-line unless you are selling to an existing customer. We had been using Taxonomy Access Control Lite to hide the Apple product taxonomy from anonymous users, and we would grant customers access by giving them an "apple customer" roll.

I have been searching for a way to display these non-salable products on our site within the catalog to everyone, but restrict the sale of the products.

The solution I had come up with was to create an additional product class called productnosale. I then created a node-productnosale.tpl.php that did not include the line print $node->content['add_to_cart']["#value"].""; and placed it in my theme directory.

This worked great in that if there is no add to cart button you can not purchase the product. The problem I still had though is that when looking at all of the products in a category there was still an add to cart button.

Yesterday while researching different project dealing with CCK I cam across a post by torgosPizza regarding Able to Purchase vs. Coming Soon. I had to modify the code slightly from

<?php
function uc_product_coming_soon_add_to_cart($nid, $qty, $data) {
$available = db_result(db_query("SELECT field_available_value FROM {content_type_product} WHERE nid = %d", $nid));

if ($available == 'N') {

$result[] = array(
'success' => FALSE,
'message' => t('Sorry, that product is not available to purchase yet.'),
);
}
return
$result;
}
?>

to

<?php

// $Id$

/**
* @file
* Is the product coming soon?
*
* Example module from Drupal book.
*/

function uc_product_coming_soon_add_to_cart($nid, $qty, $data) {
$available = db_result(db_query("SELECT field_available_value FROM {content_type_productnosale} WHERE nid = %d", $nid));

if ($available == 'N') {

$result[] = array(
'success' => FALSE,
'message' => t('Sorry, that product is not available to be purchased online. Please Call (888) 276-2907'),
);
}
return $result;
}

This makes the products truly non-salable.

In the same vein some manufacturers like Epson require us to follow minimum advertised pricing (MAP) guidelines. We had been showing only list price with a note to "add to cart for a lower price" on all products (something that drives me nuts). We recently converted the non-MAP products to their own class "productnomap" and again created a node-productnomap.tpl.php for our theme that shows list price and sell price. Moving the products was very easy. First we created the product class and then used phpmyadmin to change the node type.

Now when we export our xml data feed for Google Base we export two different feeds one for the products with no MAP that shows our sell price and another that shows list price for the products with MAP guidelines.

www.PrintersCloset.com - Epson professional graphics printers and supplies for photographers, fine art galleries, sign printers and commercial printing companies.

ferrangil's picture
Offline
Joined: 02/27/2009
Juice: 62
Re: Stuff I have learned that may be useful to someone else.

I think it's better to have a Checkbox for your products and be able to check it to "Hide Cart", for whatever reason.
This way you don't need to create an additional node type, you can use the product type and theme the node-product.tpl.php page. Just adding an "if ($node->checkbox_field_no_cart == '1')" then nothing Smiling or whatever you need...

This way I can have several different situations with "no cart", having the option to also display a text like "Out of stock" or "Out of stock until Summer 09", etc...
Doing it as you did it will lead you to create a content type "nocartuntilsummer", "nocart_outofstock", "nocart_anotherreason...".

Regards,
ferran

fehin's picture
Offline
Joined: 12/17/2008
Juice: 151
Re: Stuff I have learned that may be useful to someone else.

subscribing

activelyOUT's picture
Offline
Joined: 04/20/2009
Juice: 70
Re: Re: Stuff I have learned that may be useful to someone else.

subscribing