A fast delivery hack for one category

Rate this topic: Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.Evaluations: 1, 1.00 on the average.1.00 out of 6 based on 1 vote(s)
GK User
Sat Jun 29, 2013 10:27 am
Reply with quote
Report this post
Hi,
I would like to ask for a suggestion on how to do the following to the Gavick team:
I have one product that belongs to two categories: lightning and fast delivery. I would need a hack for the fast delivery category http://tiendanueva.negre.es/entrega-rapida.html a "fast shipping" no matter if is an overlay in the image or a text down or above the product title. B)
Is it possible to do a code something like: if "this category" show this icon or this text? only for this category.

Thanks in advance,
Kind regards,
User avatar
Gold Boarder

teitbite
Sun Jun 30, 2013 11:29 am
Reply with quote
Report this post
Hi

Yes. You can add to code of product/category a condision like:

Code: Select all
<?php
if(JRequest::getVar('id')=='55'):
echo 'text, text, text';
endif;
?>


where 55 is an id of product or category. Of course this id will be a category is in category view and a product id in product view.
User avatar
Moderator

GK User
Mon Jul 01, 2013 12:05 pm
Reply with quote
Report this post
Hi Teitbite,
I didn't understood at all what I have to do. I have to add the code provided to what file?
Thanks.
Kind Regards,
User avatar
Gold Boarder

teitbite
Mon Jul 01, 2013 7:31 pm
Reply with quote
Report this post
Hi

This time it's simple :) The file where You should add it depends where You want to display this "text, text, text". If this should be in category layout where You have small product display than You need to add this to /html/com_virtuemart/category/default.php in a loop while products are displayed. If You need it for product layout than it /html/com_virtuemart/productdetails/default.php
User avatar
Moderator

GK User
Wed Jul 03, 2013 9:56 am
Reply with quote
Report this post
Hi Teitbite,
I added the code provided

Code: Select all
<?php
if(JRequest::getVar('id')=='35'):
echo 'Entrega rápida!';
endif;
?>


to template/html/com_virtuemart/category/default.php
and don't see any text at all.
The full code is:

Code: Select all
// Show Products ?>
      <div class="product floatleft<?php echo $Browsecellwidth . $show_vertical_separator ?>">
         <div class="spacer">
            <div>
               <a title="<?php echo $product->link ?>" rel="vm-additional-images" href="<?php echo $product->link; ?>">
               
                  <?php
                     echo $product->images[0]->displayMediaThumb('class="browseProductImage"', false);
                  ?>
                </a>
            </div>
            
            <div><?php
if(JRequest::getVar('id')=='35'):
echo 'Entrega rápida!';
endif;
?>
               <h3 class="catProductTitle"><?php echo JHTML::link($product->link, $product->product_name); ?></h3>
               
               <div class="catProductPrice" id="productPrice<?php echo $product->virtuemart_product_id ?>">
               <?php
                  if ($this->show_prices == '1') {
                     if ($product->prices['salesPrice']<=0 and VmConfig::get ('askprice', 1) and  !$product->images[0]->file_is_downloadable) {
                        echo JText::_ ('COM_VIRTUEMART_PRODUCT_ASKPRICE');
                     }                  
                     echo $this->currency->createPriceDiv('basePriceWithTax', '', $product->prices);
                     echo $this->currency->createPriceDiv('taxAmount','TPL_GK_LANG_VM_INC_TAX', $product->prices);
                  } ?>
               </div>


Am I doind something wrong? :dry:
User avatar
Gold Boarder

teitbite
Thu Jul 04, 2013 12:21 pm
Reply with quote
Report this post
Hi

I could not fond my code in Your file, but I've left You some small part so You will be able to compare. I'm not sure if I understood You correctly and I gave You a code to add some informations to category, but this You can simply add as a category description. I think what You were asking for was an extra text for products, so this is a part of the code which will do that:

Code: Select all
               <?php
                  if( $product->virtuemart_product_id == '207' ):
                     echo 'Some text';
                  endif;
               ?>
User avatar
Moderator

GK User
Wed Jul 10, 2013 8:03 pm
Reply with quote
Report this post
Hi,
Thanks for the support. Can I add this code for the full category with id "35"?
If I add
if(JRequest::getVar('id')=='35'):
nothing happens.

With
<?php
if( $product->virtuemart_product_id == '207' ):
echo 'entrega rápida';
endif;
?>
there is only one product altered with the hack.
see http://negre.es/tienda/entrega-rapida.html

Also I would love to set a different text for every lang.

Kind Regards,
User avatar
Gold Boarder

teitbite
Sun Jul 14, 2013 3:00 am
Reply with quote
Report this post
Hi

To make it work with whole category, You need to replace the conditions. Use this:

Code: Select all
$this->category->virtuemart_category_id


instead of:

Code: Select all
$product->virtuemart_product_id


in the code I gave You.
User avatar
Moderator

GK User
Tue Jul 16, 2013 11:12 am
Reply with quote
Report this post
Awesome Teitbite! You rule and all the gavick team too! The support is awesome!
Is it possible to add a lang language depending of the lang we are using?
User avatar
Gold Boarder

GK User
Tue Jul 16, 2013 12:28 pm
Reply with quote
Report this post
Hi, sorry for dumping...
I need to add some style to the text we've implemented on a certain category, something like

<div style="width:96px;height:20px;position:absolute;top:-4px;left:50px;text-transform:uppercase;text-align:left;padding-left:1px;background: url(images/plane.png) right top no-repeat #fff;font-size:11px;color: #000;font-weight:bold;z-index:1;"></div>

If I insert the following:

<div style="width:96px;height:20px;position:absolute;top:-4px;left:50px;text-transform:uppercase;text-align:left;padding-left:1px;background: url(images/plane.png) right top no-repeat #fff;font-size:11px;color: #000;font-weight:bold;z-index:1;">
<?php

if( $this->category->virtuemart_category_id == '35' ):
echo 'entrega rápida';
endif;?> </div>
the hack is shown in all categories like in the example http://negre.es/tienda/sofas-y-butacas/sofas.html and I want it only in http://negre.es/tienda/entrega-rapida.html

What am I doing wrong?help please!

but where to insert the code into
User avatar
Gold Boarder

teitbite
Thu Jul 18, 2013 5:45 am
Reply with quote
Report this post
Hi

You just have placed it wrong. Please try this way:

Code: Select all
               <?php
                  if( $product->virtuemart_product_id == '207' ):
                     echo '<div style="width:96px;height:20px;position:absolute;top:-4px;left:50px;text-transform:uppercase;text-align:left;padding-left:1px;background: url(/forum/images/plane.png) right top no-repeat #fff;font-size:11px;color: #000;font-weight:bold;z-index:1;">entrega rápida</div>';
                  endif;
               ?>


but it's possible this code is wrong. I'm not sure about position absolute and z-index attributes. Need to see it on a live site so tell more.

I also advice to separate it, so the modified part would be like:

Code: Select all
               <?php
                  if( $product->virtuemart_product_id == '207' ):
                     echo '<div class="custom_text">entrega rápida</div>';
                  endif;
               ?>


and than add this to css file:

Code: Select all
.custom_text {
width:96px;
height:20px;
position:absolute;
top:-4px;
left:50px;
text-transform:uppercase;
text-align:left;
padding-left:1px;
background: url(/forum/images/plane.png) right top no-repeat #fff;
font-size:11px;
color: #000;
font-weight:bold;
z-index:1;
}
User avatar
Moderator

GK User
Thu Jul 18, 2013 10:03 am
Reply with quote
Report this post
Hi Teitbite,
Thanks and it worked like a charm! Yes, I did the style separately as you say, better to have it into the override.css, thanks for the interest!.

I have a topic opened that explain my trouble displaying the price with discount. I need to display the normal price, the discounted price and the discount amount overlayed by a line.

I opened a topic in the vm offical forum asking about this, see http://forum.virtuemart.net/index.php?topic=117258.0 they say we need to work on our override file for productdetails/default_showprices.php

Any idea?
Thanks in advance,

Kind Regards,
User avatar
Gold Boarder

teitbite
Sat Jul 20, 2013 1:41 am
Reply with quote
Report this post
Hi

It's not that I cannot solve it as You said in VM forum. It's just that a discount price is not present VM prices tables generated by VM component, so to make it I would need to make a hack to the core VM files. That's why I adviced to ask VM support how to add this new prices to this associacion table component provides.

Anyway if solution is hidden in default_showprices.php file than I'm affraid I cannot help. We have not customized this file in our template. We are using a default VM file, so this would be considered as customization which we do not support. Sorry.
User avatar
Moderator


cron