News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Category Page: Turn Product "Internal Notes" into custom link

Started by PRO, November 02, 2012, 19:35:45 PM

Previous topic - Next topic

PRO

Guys,

I wrote a little function to use the "Internal Notes" as a custom field in category page.

It creates a link to the product with the "anchor" you specify, and also you have the option to specify the "link title"
I use mine in certain categories to display   "View Sizes" or "View Colors"
You can then add the colors & sizes to the "Link title" so your users can view them without clicking

You just format your product internal notes like this

Anchor > Link Title

Here is the function that goes at the top of the category template

<?php function extendedNotes($notes,$link){
      $link=$link;
      $alt= strstr($notes,">") ;
      $alt=str_replace( '>', '', $alt);
      $text =str_replace( $alt, '', $notes );
      $text =str_replace( '>', '', $text );
      ?>
      <a href="<?php echo $link ?>" title="<?php echo $alt ?>"><?php echo $text ?></a>
      
<?php } ?>

This is the code you put inside the foreach ($products as $product)

<?php if (!empty($product->intnotes)) {
         echo extendedNotes($product->intnotes,$product->link);
    } ?>





[attachment cleanup by admin]

luiscvz

Good info to me, give me a hand to put some information in category view.

Thanks!

Pejo

This works great, but is it possible to somehow call image instead of text? For example to convert link inserted in internal note? Maybe more of them (more images), separating links of images like here?

I am trying to insert small circles of colours under the product image, this is the closest thing I found, and I have searching this forum for hours. Tried five-sixes different codes, nothing works.

I have 3rd party template, Joomla 3.6.2 - VM 3.0.8

tried this:

<div class="product-fields">
       <?php
       $custom_title 
null;
       foreach (
$this->product->customfieldsSorted[external] as $field) {
      if (
$field->display) {
          
?>

          <?php if ($field->custom_title != $custom_title) { ?>
            <img src="<?php echo $field->display ?>" alt="<?php echo $this->product->product_name ?>"  />
<?php ?>
          <?php ?> <?php ?>
        </div>


and this:

<?php // Product custom_fields
if (!empty($product->customfieldsCart)) {  ?>

<div class="product-fields">
<?php foreach ($product->customfieldsCart as $field)
?>
<div style="display:inline-block;" class="product-field product-field-type-<?php echo $field->field_type ?>">
<span class="product-fields-title" ><b><?php echo  JText::_($field->custom_title?></b></span>
<span class="product-field-display"><?php echo $field->display ?></span>
<span class="product-field-cat-desc"><?php echo $field->custom_field_desc ?></span>
</div><br/ >

<?php
}
?>

</div>


also this:

<?php $custom_title null
if (!empty(
$product->customfields)) {
foreach (
$product->customfields as $field) {
if (
$field->is_hidden //OSP http://forum.virtuemart.net/index.php?topic=99320.0
continue;
if (
$field->display) { ?>

<span class="product-field-display"><?php echo $field->display ?></span>
<?php ?> <?php ?> <?php }  ?>


Just nothing does the job. This codes does, but I need small images instead of text. Is this doable?
Thanks in advance for your help ;)

PRO

That code was from OLD vmart
VM3 is easier

I use custom field "editor"
to make swatch HTML

layout position
category_swatch

The in sublayouts/products.php

      <?php      if   (!empty($product->customfieldsSorted['category_swatch']))   {      
   foreach ($product->customfieldsSorted['category_swatch'] as $field) {
   $field->display  = str_replace( '<p>', '', $field->display);
    $field->display  = str_replace( '</p>', '', $field->display);
    echo '<div class="swatch"><a title="'.$product->product_name.'" href="'.$product->link.$ItemidStr.'">';
echo $field->display.'</a><div class="wrap"></div></div>';
      } } ?>

Pejo

Pro, THANKS! You are my man! I just love you!  ;D ;D ;D

Works like a charm!

Hope someone will give back to you all this good work. Thanks again. You don't know how much you've helped.  ;)

PRO FOR PRESIDENT!