Viewing 15 posts - 1 through 15 (of 18 total)
  • Author
    Posts
  • petrahk Friend
    #145861

    Hi!
    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 Moderator
    #323649

    Hello 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

    petrahk Friend
    #323891

    Hi 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,
    Petra

    Saguaros Moderator
    #323895

    Yes, 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 Slide

    petrahk Friend
    #323900

    I disabled price in JA VM product slide. Price disappeared, but the name of category not shows. :confused:

    petrahk Friend
    #323903

    file 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 Moderator
    #323904

    Oh, 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.

    Saguaros Moderator
    #323908

    Here 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]

    petrahk Friend
    #323911

    I 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 Moderator
    #323914

    All are ok without mistake, they work well on my site.

    Error 500 is the problemf of your server
    http://www.checkupdown.com/status/E500.html

    petrahk Friend
    #323915

    if I delete the line
    [PHP] $tpl->set(‘category_name’, $ps_product_category->get_name( $product_id ) ); [/PHP]
    I have no error 500.

    Saguaros Moderator
    #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]

    petrahk Friend
    #323919

    Can you paste here the php code of your file ministrartor/components/com_virtualmart/classess/ps_product.php?

    Many thanx!!!

    Saguaros Moderator
    #323921

    oh, may be you are using the old verion, give me your file or parste codes in here, i looking for the error happen on this.

    petrahk Friend
    #323922

    Fantastic!!! It works!!! ?Many thanx!!!

    And last question: where I can change font style of category? In css?

Viewing 15 posts - 1 through 15 (of 18 total)

This topic contains 18 replies, has 2 voices, and was last updated by  petrahk 15 years ago.

We moved to new unified forum. Please post all new support queries in our New Forum