Jump to content

Image Class "th"


Claudia

Recommended Posts

I have setup a new section in my product listings that I use for some of my listings. It's Called Use With (or Related too).  It shows images of items that can be used for that product listing along with a link to that item.  My question is how do I get the image "th" class to work on these images?

I have setup a new folder in the main images file (/public_html/images/related/) to store the images used.

 Here's a page example

FYI - Here's a sample of the code I'm now using.  I tried to put the img class="th" src code and rearranged the alt and title but it wouldn't take.

 

<div class="title-related thinmarg-top">Use with Our:</div>

 

<div class="row pad-topbottom">

<div class="small-12 medium-3 large-3 columns center">

<a href="/tealight-candles-and-more"><img alt="Tealight Candles" src="../images/related/candle-tealight-lot-5-150.jpg" style="border-width: 0px;" title="Tealight Candles" /></a><br />

<a class="related center" href="/tealight-candles-and-more" target="_blank" title="Tealight Candles">Tealight Candles</a>

</div>

Thanks for any all help!!!

 

 

Link to comment
Share on other sites

I don't know if that will work for me or not.  Even when I change my code, the frontend page still shows the original, though the admin shows the changes. Here's my revised testing code.  I have even checked my admin product skin and source codes.

<div class="small-12 medium-3 large-3 columns center">

<a href="/tealight-candles-and-more" title="Tealight Candles"><img class="th" alt="Tealight Candles" src="../images/related/candle-tealight-lot-5-150.jpg" title="Tealight Candles"></a><br />

<a class="related center" href="/tealight-candles-and-more" target="_blank" title="Tealight Candles">Tealight Candles</a>

</div>

Link to comment
Share on other sites

"I change my code -- from what to what? "  From the code in the original post to what you gave me

"Still shows the original -- what? " from the code in the original post

"Is this "code" actually part of the product's Description? "  No it's a new section I created .... It all worked (not the "th" in 6.5.1).  I guess if I had to I could add it to the product description.

ADMIN PRODUCTS SOURCES

$record = $_POST;
    $record['description'] = $GLOBALS['RAW']['POST']['description'];
    $record['sold_venue_tag'] = $GLOBALS['RAW']['POST']['sold_venue_tag'];
    $record['related_used_with'] = $GLOBALS['RAW']['POST']['related_used_with'];
    unset($record['categories'], $record['group'], $record['image']);

 

ADMIN PRODUCTS SKIN

<fieldset>
         <legend style="width:99.5%">Sold Venue Tag</legend>
        <textarea name="sold_venue_tag" id="sold_venue_tag" class="textbox fck">{$PRODUCT.sold_venue_tag}</textarea>
</fieldset>
</td>
  <td width="1%">         &nbsp;                </td>
                    
                     <td width="48%">  
     <fieldset>
         <legend style="width:99.5%">{$LANG.common.description}</legend>
      <textarea name="description" id="description" class="textbox fck">{$PRODUCT.description}</textarea>
    </fieldset>
     </td>
        
            </tr>
            </table>
            <table width="50%">
             <tr>
<td width="50%">  
     <fieldset>
         <legend style="width:99.5%">Related / Used With</legend>
      <textarea name="related_used_with" id="related_used_with" class="textbox fck">{$PRODUCT.related_used_with}</textarea>
    </fieldset>

If I make it part of the description it works ...  but.... it is placed above the products specs. and even though I delete the code in the related_used_with it still shows.

Link to comment
Share on other sites

I see that in admin, there is a dedicated editor for 'related_used_with' - and I assume there is a database column for it.

Have CubeCart's debug mode enabled. Save the edit screen after making sure that the class="th" is part of the <img> tag as seen above.

In the debug window, CubeCart will show what was received in the POST payload. Confirm the <img> tag has the class="th" attribute.

If this attribute is not present, then we might think that the editor is stripping it away. Which is strange.

 

Link to comment
Share on other sites

"Do I need to add the related_used_with and specs to the product description?"

You shouldn't have to. The content of the 'related_used_with' editor, being databased in a new column of the CubeCart_inventory database table, then retrieved as an element of all data found in that record, should be part of Smarty's $PRODUCT array. (I assume you had CubeCart clear its internal cache after saving the edited data.)

Link to comment
Share on other sites

This is the part of debug in admin for the example page.

'related_used_with' => &lt;div class=&quot;title-related thinmarg-top&quot;&gt;Use with Our:&lt;/div&gt;

&lt;div class=&quot;row pad-topbottom&quot;&gt;
&lt;div class=&quot;small-12 medium-3 large-3 columns center&quot;&gt;&lt;a href=&quot;/tealight-candles-and-more&quot; title=&quot;Tealight Candles&quot;&gt;&lt;img alt=&quot;Tealight Candles&quot; class=&quot;th&quot; src=&quot;../images/related/candle-tealight-lot-5-150.jpg&quot; title=&quot;Tealight Candles&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;related center&quot; href=&quot;/tealight-candles-and-more&quot; target=&quot;_blank&quot; title=&quot;Tealight Candles&quot;&gt;Tealight Candles&lt;/a&gt;&lt;/div&gt;

&lt;div class=&quot;small-12 medium-3 large-3 columns center&quot;&gt;&lt;a href=&quot;/scented-oils&quot; title=&quot;Scented Oils&quot;&gt;&lt;img alt=&quot;Scented Oils&quot; class=&quot;th&quot; src=&quot;../images/related/scented-oils-lot-5-150.jpg&quot; title=&quot;Scented Oils&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;related center&quot; href=&quot;/scented-oils&quot; target=&quot;_blank&quot; title=&quot;Scented Oils&quot;&gt;Scented Oils&lt;/a&gt;&lt;/div&gt;

&lt;div class=&quot;small-12 medium-3 large-3 columns center&quot;&gt;&lt;a href=&quot;/scented-tarts&quot;&gt;&lt;img alt=&quot;Scented Tarts&quot; class=&quot;th&quot; img=&quot;&quot; src=&quot;../images/related/scented-tarts-lot-6-150.jpg&quot; title=&quot;Scented Tarts&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;a class=&quot;related center&quot; href=&quot;/scented-tarts&quot; target=&quot;_blank&quot; title=&quot;Scented Tarts&quot;&gt;Scented Tarts&lt;/a&gt;&lt;/div&gt;

Link to comment
Share on other sites

Again, I assume you had CubeCart clear its internal cache after saving the edited data. That is necessary because the result from the query in the Catalogue class, function getProductData(), the database record will be pulled from CubeCart's internal cache - if it exists.

Link to comment
Share on other sites

We know that editing the product's description (having put the code in Angel and Child) does show the changes on the storefront.

Please show the custom template code (5 lines before and 5 lines after) where the Smarty variable $PRODUCT.related_used_with is located.

 

Link to comment
Share on other sites

Here you go.  This is my skin code.  

        {if $PRODUCT.specs_title_12}
                  <div class="block_container">  <div class="bc-subtitle"> {$PRODUCT.specs_title_12}</div>
                  {/if}
                   {if $PRODUCT.specs_content_12}
                     <div class="bc-txt">{$PRODUCT.specs_content_12}</div></div>
                  {/if}

         {if ($PRODUCT.related_used_with)}
              <div>
     {$PRODUCT.related_used_with}
             </div>   
              {/if}

                </form>
              
        <div class="hide" id="validate_field_required">{$LANG.form.field_required}</div>
</div>
{else}
<p>{$LANG.catalogue.product_doesnt_exist}</p>
{/if}

 

Link to comment
Share on other sites

I took the () out and it works!  Thanks Brian

FYI: I had the () in because that what shows in product description and I was just following what it did.

Well I don't know what is going on now!  I looked at another product that has this and look!  Plus none of it is showing in the editor in the admin skin product page

https://www.cambargainstore.com/candle-lamp-cowboys

I got it to work

Link to comment
Share on other sites

In my opinion, those parenthesis should have caused a different problem, resulting in not showing that content at all.

Very strange!

Parentheses are used to force an "order-of-math-operations", or as a "container" of function arguments. But, since there was no function name preceding the function argument "container", PHP should have complained about something wrong with the statement syntax.

However, this was inside braces - which are reserved for Smarty statements. Thus, Smarty will "parse" its statements, compiling them into real PHP statements. You can see the compiled result files in the /cache/skin/ folder.

For myself, the process by which Smarty parses its statements, and how it deals with anomalies, is unknown. Therefore, why Smarty would use "stored/cached" contents of a variable, let alone where those contents could possibly be stored/cached -- I have no idea.

I do plan to conduct my own experiments to try to replicate this situation.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...