-
AuthorPosts
-
petrahk Friend
petrahk
- Join date:
- March 2009
- Posts:
- 145
- Downloads:
- 8
- Uploads:
- 10
- Thanks:
- 38
- Thanked:
- 3 times in 1 posts
November 8, 2009 at 12:54 pm #145861Hi!
I would like to have the name of category in slideshow – instead of price (under the thumbnail).Can anybody help?
I’ve tried to overwrite all “show_price” with “show_category” in xml and php files, but it does not work.:-[
Thank you!!!
Petra
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
November 16, 2009 at 2:28 am #323649Hello petrahk!
The JA VM Product Slide Intergrated with the VirtueMart library to render Item in the list.
My personal opinion, to do something as you said, i think we have a change about code in the VirtualMart Libary, i’ll give you specific intructions as following:1) You open the administrartor/components/com_virtualmart/classess/ps_product.php file and add this code at line 2330:
[PHP]$tpl->set(‘category_name’, $ps_product_category->get_name( $product_id ) );[/PHP]2) Next, You open the file /components/com_virtualmart/themes/ja-mesolite/templates/common/productssnapshot.tpl.php file and add this at line 18:
[PHP]echo $category_name;[/PHP]
and add comment a section code at line 16:
[PHP]//echo $price;[/PHP]
good luck
1 user says Thank You to Saguaros for this useful post
petrahk Friendpetrahk
- Join date:
- March 2009
- Posts:
- 145
- Downloads:
- 8
- Uploads:
- 10
- Thanks:
- 38
- Thanked:
- 3 times in 1 posts
November 17, 2009 at 7:44 am #323891Hi Tienhc,
thank you very much for your effort. I tried to do what you described above, but unfortunatelly – it does not work…
Maybe a made a mistake in step 3)
Where exactly I should write “//echo $price; “?
In file located at /components/com_virtualmart/themes/ja-mesolite/templates/common/productssnapshot.tpl.php
in line 16?
Thank you very much,
PetraSaguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
November 17, 2009 at 7:51 am #323895Yes, that’s right, you add a comment line at line 16.
Or you turn off display price in the configuration of The JA VM Product Slidepetrahk Friendpetrahk
- Join date:
- March 2009
- Posts:
- 145
- Downloads:
- 8
- Uploads:
- 10
- Thanks:
- 38
- Thanked:
- 3 times in 1 posts
November 17, 2009 at 8:00 am #323900I disabled price in JA VM product slide. Price disappeared, but the name of category not shows. :confused:
petrahk Friendpetrahk
- Join date:
- March 2009
- Posts:
- 145
- Downloads:
- 8
- Uploads:
- 10
- Thanks:
- 38
- Thanked:
- 3 times in 1 posts
November 17, 2009 at 8:06 am #323903file file /components/com_virtualmart/themes/ja-mesolite/templates/common/productssnapshot.tpl.php is like this:
[PHP]<?php if( !defined( ‘_VALID_MOS’ ) && !defined( ‘_JEXEC’ ) ) die( ‘Direct Access to ‘.basename(__FILE__).’ is not allowed.’ ); ?>
<span style=”font-weight:bold;”><?php echo $product_name ?></span>
<br /><a title=”<?php echo $product_name ?>” href=”<?php echo $product_link ?>”>
<?php
// Print the product image or the “no image available” image
echo ps_product::image_tag( $product_thumb_image, “alt=””.$product_name.”””);
?>
</a>
<br /><?php
if( !empty($price) ) {
//echo $price;
echo $price;
echo $category_name;
}
?>
<?php
if( !empty($addtocart_link) ) {
?>
<br />
<form action=”<?php echo $mm_action_url ?>index.php” method=”post”>
<input type=”hidden” name=”option” value=”com_virtuemart” />
<input type=”hidden” name=”page” value=”shop.cart” />
<input type=”hidden” name=”Itemid” value=”<?php echo ps_session::getShopItemid(); ?>” />
<input type=”hidden” name=”func” value=”cartAdd” />
<input type=”hidden” name=”prod_id” value=”<?php echo $product_id; ?>” />
<input type=”hidden” name=”product_id” value=”<?php echo $product_id ?>” />
<input type=”hidden” name=”quantity” value=”1″ />
<input type=”hidden” name=”set_price[]” value=”” />
<input type=”hidden” name=”adjust_price[]” value=”” />
<input type=”hidden” name=”master_product[]” value=”” />
<input type=”submit” class=”addtocart_button_module” value=”<?php echo $VM_LANG->_(‘PHPSHOP_CART_ADD_TO’) ?>” title=”<?php echo $VM_LANG->_(‘PHPSHOP_CART_ADD_TO’) ?>” />
</form>
<br />
<?php
}
?>[/PHP]correct?
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
November 17, 2009 at 8:09 am #323904Oh, may be you added this block codes [PHP]echo $category_name;[/PHP] incorrect.
from line 14 to 18
[PHP]
<?php
if( !empty($price) ) {
echo $price;
}
?>
[/PHP]
You replace them by:
[PHP]
<?php
if( !empty($price) ) {
echo $price;
}
echo $category_name;
?>
[/PHP]Please try again.
1 user says Thank You to Saguaros for this useful post
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
November 17, 2009 at 8:12 am #323908Here is correct
[PHP]<?php if( !defined( ‘_VALID_MOS’ ) && !defined( ‘_JEXEC’ ) ) die( ‘Direct Access to ‘.basename(__FILE__).’ is not allowed.’ ); ?><span style=”font-weight:bold;”><?php echo $product_name ?></span>
<br /><a title=”<?php echo $product_name ?>” href=”<?php echo $product_link ?>”>
<?php
// Print the product image or the “no image available” image
echo ps_product::image_tag( $product_thumb_image, “alt=””.$product_name.”””);
?>
</a>
<br /><?php
if( !empty($price) ) {
echo $price;
}
echo $category_name;
?>
<?php
if( !empty($addtocart_link) ) {
?>
<br />
<form action=”<?php echo $mm_action_url ?>index.php” method=”post”>
<input type=”hidden” name=”option” value=”com_virtuemart” />
<input type=”hidden” name=”page” value=”shop.cart” />
<input type=”hidden” name=”Itemid” value=”<?php echo ps_session::getShopItemid(); ?>” />
<input type=”hidden” name=”func” value=”cartAdd” />
<input type=”hidden” name=”prod_id” value=”<?php echo $product_id; ?>” />
<input type=”hidden” name=”product_id” value=”<?php echo $product_id ?>” />
<input type=”hidden” name=”quantity” value=”1″ />
<input type=”hidden” name=”set_price[]” value=”” />
<input type=”hidden” name=”adjust_price[]” value=”” />
<input type=”hidden” name=”master_product[]” value=”” />
<input type=”submit” class=”addtocart_button_module” value=”<?php echo $VM_LANG->_(‘PHPSHOP_CART_ADD_TO’) ?>” title=”<?php echo $VM_LANG->_(‘PHPSHOP_CART_ADD_TO’) ?>” />
</form>
<br />
<?php
}
?> [/PHP]1 user says Thank You to Saguaros for this useful post
petrahk Friendpetrahk
- Join date:
- March 2009
- Posts:
- 145
- Downloads:
- 8
- Uploads:
- 10
- Thanks:
- 38
- Thanked:
- 3 times in 1 posts
November 17, 2009 at 8:17 am #323911I have problem also with first step. I got error 500 after this change at file
administrartor/components/com_virtualmart/classess/ps_product.php[PHP] }
$prices_table .= “</tbody></table>”;
if( @$_REQUEST[‘page’] != “shop.product_details” ) {
$html .= vmToolTip( $prices_table );
}
else
$html .= $prices_table;
}
}
}
$tpl->set( ‘discount_info’, $discount_info );
$tpl->set( ‘text_including_tax’, $text_including_tax );
$tpl->set( ‘undiscounted_price’, @$undiscounted_price );
$tpl->set( ‘base_price’, $base_price );
$tpl->set( ‘price_table’, $html);
$tpl->set(‘category_name’, $ps_product_category->get_name( $product_id ) );
return $tpl->fetch( ‘common/price.tpl.php’);
}/**
* Get the information about the discount for a product
* @param int $product_id
* @return array The discount information
*/
function get_discount( $product_id ) {
global $mosConfig_lifetime;[/PHP]Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
November 17, 2009 at 8:23 am #323914All are ok without mistake, they work well on my site.
Error 500 is the problemf of your server
http://www.checkupdown.com/status/E500.htmlpetrahk Friendpetrahk
- Join date:
- March 2009
- Posts:
- 145
- Downloads:
- 8
- Uploads:
- 10
- Thanks:
- 38
- Thanked:
- 3 times in 1 posts
November 17, 2009 at 8:25 am #323915if I delete the line
[PHP] $tpl->set(‘category_name’, $ps_product_category->get_name( $product_id ) ); [/PHP]
I have no error 500.Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
November 17, 2009 at 8:27 am #323918[PHP]
/**
* Returns HTML code for a snapshot of a product based on the product sku.
* This was written to provide a quick way to display a product inside of modules
*
* @param string $product_sku The SKU identifying the product
* @param boolean $show_price Show the product price?
* @param boolean $show_addtocart Show the add-to-cart link?
* @param boolean $show_product_name Show the product name?
*/
function product_snapshot( $product_sku, $show_price=true, $show_addtocart=true, $show_product_name = true ) {global $sess, $mm_action_url;
$db = new ps_DB;
require_once(CLASSPATH.’ps_product_category.php’);
$ps_product_category = new ps_product_category;$q = “SELECT product_id, product_name, product_parent_id, product_thumb_image FROM #__{vm}_product WHERE product_sku=’$product_sku'”;
$db->query( $q );if ($db->next_record()) {
$product_id = $db->f(“product_id” );
$tpl = new $GLOBALS[‘VM_THEMECLASS’]();$cid = $ps_product_category->get_cid( $product_id );
$tpl->set(‘category_name’, $ps_product_category->get_name( $product_id ) );
$tpl->set( ‘product_id’, $product_id);
$tpl->set( ‘product_name’, $db->f(“product_name”) );
$tpl->set( ‘show_product_name’, $show_product_name );if ($db->f(“product_parent_id”)) {
$url = “?page=shop.product_details&category_id=$cid&flypage=”.$this->get_flypage($db->f(“product_parent_id”));
$url .= “&product_id=” . $db->f(“product_parent_id”);
} else {
$url = “?page=shop.product_details&category_id=$cid&flypage=”.$this->get_flypage($db->f(“product_id”));
$url .= “&product_id=” . $db->f(“product_id”);
}
$product_link = $sess->url($mm_action_url. “index.php” . $url);
$tpl->set( ‘product_link’, $product_link );
$tpl->set( ‘product_thumb_image’, $db->f(“product_thumb_image”), “alt=””.$db->f(“product_name”).”””);if (_SHOW_PRICES == ‘1’ && $show_price) {
// Show price, but without “including X% tax”
$price = $this->show_price( $db->f(“product_id”), true );
$tpl->set( ‘price’, $price );
}
if (USE_AS_CATALOGUE != 1 && $show_addtocart && isset( $GLOBALS[‘product_info’][$product_id][‘price’][‘product_price_id’] )) {
$url = “?page=shop.cart&func=cartAdd&product_id=” . $db->f(“product_id”);
$addtocart_link = $sess->url($mm_action_url. “index.php” . $url);
$tpl->set( ‘addtocart_link’, $addtocart_link );
}
return $tpl->fetch( ‘common/productsnapshot.tpl.php’);
}return ”;
}
[/PHP]
1 user says Thank You to Saguaros for this useful post
petrahk Friendpetrahk
- Join date:
- March 2009
- Posts:
- 145
- Downloads:
- 8
- Uploads:
- 10
- Thanks:
- 38
- Thanked:
- 3 times in 1 posts
November 17, 2009 at 8:28 am #323919Can you paste here the php code of your file ministrartor/components/com_virtualmart/classess/ps_product.php?
Many thanx!!!
Saguaros ModeratorSaguaros
- Join date:
- September 2014
- Posts:
- 31405
- Downloads:
- 237
- Uploads:
- 471
- Thanks:
- 845
- Thanked:
- 5346 times in 4964 posts
-
AuthorPosts
This topic contains 18 replies, has 2 voices, and was last updated by petrahk 14 years, 12 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum