Author Topic: Featured Products - how to turn of displaying name of product  (Read 4163 times)

aliceinpl

  • Beginner
  • *
  • Posts: 4
I have modified the featured products mod so it displays the way I want (as in it no longer displays anything but the image and the stupid product name). So how to I fix this? The product name is interferring with the design I have. If I modify a php file (I'm assuming finding {product_name} or the sort), which one do I mod?

Thank you so much for your help in advance. I am relatively new to the community but am impressed by how much time everyone spends helping others.

miss cassandra

  • Beginner
  • *
  • Posts: 5
Re: Featured Products - how to turn of displaying name of product
« Reply #1 on: April 08, 2009, 22:58:36 pm »
Back for 1.0, I there was a thread about the similar issue: http://forum.virtuemart.net/index.php?topic=29806.msg86351#msg86351 but it talks about custom functions, etc. and at least now there is definitely an easier way ...

... If you're using mod_virtuemart_featuredprod ... you'll have to modify the main file for that module:

*yourjoomlahome*/modules/mod_virtuemart_featuredprod/mod_virtuemart_featuredprod.php

around line 107 you'll see
Code: [Select]
$ps_product->show_snapshot($db->f("product_sku"), $show_price, $show_addtocart);
after $show_addtocart you can simply set the value for the last optional parameter $show_product_name by changing that whole line to read:
Code: [Select]
$ps_product->show_snapshot($db->f("product_sku"), $show_price, $show_addtocart, $show_product_name=false);
It works like this: the class ps_product (in file ps_product.php) has a method show_snapshot() which is used for displaying product basics in those side modules, etc ...

Only its first parameter, $product_sku is required, and the following three are optional and default to "true":

$show_price
$show_addtocart
$show_product_name

For the Featured Products, the values for $show_price and $show_addtocart are pulled from the parameters you choose in the Joomla! backend when you activate and place the module.  I don't know why you can't toggle the name the same way, so doing what's described above should fix it for you.

I hope that helps ;)

~*~Casse

aliceinpl

  • Beginner
  • *
  • Posts: 4
Re: Featured Products - how to turn of displaying name of product
« Reply #2 on: April 09, 2009, 01:05:27 am »
awesome!

thank you so much, that is exactly what I was looking for. like I said earlier, I am simply amazed by how much help is given through this forum and you are absolute proof.


miss cassandra

  • Beginner
  • *
  • Posts: 5
Re: Featured Products - how to turn of displaying name of product
« Reply #3 on: April 09, 2009, 01:42:25 am »
good luck! i just had to tackle something similar, I'm glad I could save someone else the trouble :)

aliceinpl

  • Beginner
  • *
  • Posts: 4
Re: Featured Products - how to turn of displaying name of product
« Reply #4 on: April 09, 2009, 01:59:18 am »
Okay. I tried your suggestion and I must confess it did not work. I was messing around a bit more and found that if I modified ps_product.php found in:

/public_html/joomla_directory/administrator/components/com_virtuemart/classes/

by replacing:

$q = "SELECT product_id, product_name, product_parent_id, product_thumb_image FROM #__{vm}_product WHERE product_sku='$product_sku'";
      $db->query( $q );

with:

$q = "SELECT product_id, product_parent_id, product_thumb_image FROM #__{vm}_product WHERE product_sku='$product_sku'";
      $db->query( $q );

it would get the effect I needed. For other users looking over this, I found the line to modify around line 2325


miss cassandra

  • Beginner
  • *
  • Posts: 5
Re: Featured Products - how to turn of displaying name of product
« Reply #5 on: April 09, 2009, 03:13:44 am »
Very interesting.  I always try the "furthest from the core" hacks first and mine worked fine to remove that name from display.  -- Funny how you can find so many ways to fix the same thing -- Where I toggle off the display of the name, you essentially don't pull the name in the first place so there's nothing to display.  Excellent :) 

The only thing is, and I don't know that it matters for your situation, if you're modifying the core method for retrieving snapshot information (in this case product_snapshot()), it will change the display in any mods that rely on  that same method (i.e. the title won't show anywhere show_snapshot() is called).  You'd have to build another method to call in case you wanted to show the title in another mod.

Just a note, but I'm glad you got it fixed! This little stuff can really eat up time in an otherwise smooth project ;)