Hi Guys..,
My customer has a few items in his product range where the prices change very quickly, so he would like to change the value to zero and have the ubercart display "Call for price" instead of the zero value; also the "add to cart" button should be disabled.
I have been looking into this and trying various solutions for the past 3 days with some success...
I would prefer to create a module...see below.. rather than a theme mod.
I have found some code.. (I will credit the person who wrote it when I find it again)
The code uses the nodeapi to change the product display which works fine, but the product grid still shows the £0.00 and the "add to cart" button. I have tried various things to try and change the product grid but no joy...
the code...
// $Id$
/**
* @file
* uc_acsCall4Price.module
* Ubercart where the product has a zero value display call for pricing
*/
/**
* Implementation of hook_nodeapi()
*/
function uc_acsCall4Price_nodeapi(&$node, $op, $a3 = NULL, $a3 = NULL, $a4 = NULL){
//This bit works and changes the product display
if ($op == 'view' ){
if ($node->type == 'product' ){
//drupal_set_message("uc_acsCall4Price_hook_node here..","status")
if (intval($node->sell_price)==0) {
$node->content['sell_price']['#value'] = "<div class=\"call-for-pricing\">Call for pricing</div>";
$node->content['display_price']['#value'] = "<div class=\"call-for-pricing2\">Call for pricing</div>" ;
unset($node->content['add_to_cart']) ; // remove add to cart button
}
}
// this is an attempt to change the grid display
if ($node->type == 'category' ){
//drupal_set_message("uc_acsCall4Price_hook_node here..","status")
if (intval($node->sell_price)==0) {
$node->content['sell_price']['#value'] = "<div class=\"call-for-pricing\">Call for pricing</div>";
$node->content['display_price']['#value'] = "<div class=\"call-for-pricing2\">Call for pricing</div>" ;
unset($node->content['add_to_cart']) ; // remove add to cart button
}
}
}
}
The first part works, the second to try and change the grid display does not work.
Again I have tried various things... including trying to hook into **function uc_catalog_nodeapi**
and a dozen other approaches...
So, anyone know how I can access the grip product view similar to the first section of the code that works.
Hope this makes sense... I'm a little frustrated with all of the reading i have been doing and going around in circles...
Many thank for looking and I hope someone can help.
Regards
Steve
Comments
I guess its only the easy
I guess its only the easy problems that get answered, and the sarcasem posts and the ones telling people not to post in all upper case characters :)
Ah well.... Back to the drawing board.
_
no... but you'll often find that posters making snide comments about the very volunteers from which they're requesting help won't usually get a response. Particularly when they've been members for years and never bothered to help anyone else.
I agree... and I do look at
I agree... and I do look at posts but feel others know better than I do regarding drupal. WHich is why I keep quiet.
And I did put a smilie on the end, but you have just proved my point *shrugs*
_
and you proved mine. Snide comments from entitled users get really really really old very quickly. Adding a smiley doesn't diminish the insult-- it only elevates it to passive agressiveness. Why would any volunteer want to help someone after a comment like that?
I'll never understand why people think this is ok behavior in open source-- would you behave the same way if you were asking a neighbor who's mowing their lawn to also mow your lawn for you for free? And what kind of a schmuck would they be if they actually went ahead and did it after being spoken to like that, lol.
Take it any way you want...
Take it any way you want... if thats all you have to say, why not go and help people who can't be bothered to help themselves, I have only asked for help a couple of times and that was after 3 or 4 days of investigating options and researching a solution then hitting deadends. So if you want to critisise others, drag others down thats fine... I was making a valid statement... It only seems that the easy questions get answered when a little reasearch by the poster would infact lead them to the solution.
If I came across as snide that's because I have put a lot of time and effort into Drupal, trying to learn, to become proficient and become knowledgeable to an extent where I would feel confident at helping others... But your tone / attitude only reinforces my thinking even more.
And this thread is now pointless, a total waste of my time and yours. Like so many other threads I have read.
Getting back to the original post
I'm interested in having this option also.
I'm getting closer to a solution
I have the product display working, just trying to get the catalog view to work.... When I have a solution I will post it.
Regards
Steve
just some guesses to maybe help point you...
I've not done what you are saying, but I'm assuming the 'grid' is a generated by a view, and every single file output by a view can be overridden by a theme template, so I think you might have to create field-level templates that look at the price and change the output when the price is zero. I definitely think this is a view template solution, if the grid is generate by a view.
Finally, you can also do a view template pre-process function which lets you gain access to all the variables before the view is rendered and then modify them.
Maybe you knew all of this and it didn't work,just thought I'd offer.
Its not a view :)
Its not a view... see next post :)
Done... ish...
Ok, I now have it working with the grid view on the catalog and on the product display page....
Going to look at creating a proper plugin ... don't know how to do that... so need to do some research... and if that goes the same way as all of my efforts with drupal the documentation will be shocking *grin*
Ubercart is good and it works, but the coding structure is not really errm.. consistent... which makes it very difficult for a someone like me to follow :( and create modifications.
I've not done the list view of products. I will do it eventually, but again, they have done it with an call to tapir_get_table and not kept things consitant.
If anyone wants the solution before... Let me know. Its been a very big learning curve and I don't recommend it :) - Debugging php is a nightmare :)
Thanks to the drupal quickstart virtual linux software... http://drupal.org/project/quickstart it really helped.
Thanks for looking...
Regards
How...did you do it?
Hi
Also need this functionality. Please can you provide some [simple] instructions.
Thanks
Hi BLOK.., I'm in the process
Hi BLOK..,
I'm in the process of creating a downloadable module with full instructions.
If you need it before the end of September drop me a line.
I am trying to get this up and running over the weekend.
Regards
Steve
Thanks!
Cheers Steve. Thanks both for reply & the work
Commerce Kickstart - Call for Price
I'm also interested in doing this for a Commerce_Kickstart site using Drupal 7.X
Dan