Post by cosmo » Mon Feb 18, 2013 3:46 am

U need to alter the database request in the model-file (catalog/model/product )
I know I currently have an error in mine so I won't share it until it's fixed.

New member

Posts

Joined
Sat Apr 10, 2010 3:26 pm

Post by Lundii30 » Mon Feb 18, 2013 3:59 am

Cosmo, thank you for your reply. Please let me know if you have any luck with the model-file.

Newbie

Posts

Joined
Wed Jan 23, 2013 10:50 pm

Post by cosmo » Tue Feb 19, 2013 12:21 am

Fixed the model and control for the product page presentation.
Product page template file needs to be edited something like (example based on default schema):

Code: Select all

<?php if ($thumb || $images) { ?>
    <div class="left">
      <?php if ($thumb) { ?>
      <div class="image"><a href="<?php echo $popup; ?>" title="<?php echo $heading_title; ?>" class="colorbox" rel="colorbox"><img src="<?php echo $thumb; ?>" title="<?php echo $image_title_text; ?>" alt="<?php echo $image_alt_text; ?>" id="image" /></a></div>
      <?php } ?>
      <?php if ($images) { ?>
      <div class="image-additional">
        <?php foreach ($images as $image) { ?>
        <a href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>" class="colorbox" rel="colorbox"><img src="<?php echo $image['thumb']; ?>" title="<?php echo $image['image_title_text']; ?>" alt="<?php echo $image['image_alt_text']; ?>" /></a>
        <?php } ?>
      </div>
      <?php } ?>
    </div>
    <?php } ?>
More work is coming to deploy texts to category listings page, search results page and so on...

File deleted
Last edited by cosmo on Thu Feb 21, 2013 12:15 am, edited 1 time in total.

New member

Posts

Joined
Sat Apr 10, 2010 3:26 pm

Post by Lundii30 » Tue Feb 19, 2013 3:24 am

Wow thanks a lot Cosmo, I will definitely give it a try!
Appreciate your help!

Newbie

Posts

Joined
Wed Jan 23, 2013 10:50 pm

Post by Lundii30 » Tue Feb 19, 2013 9:26 am

It doesn't really seem to work for me..
what do I put in the catalog/controller/product/product.php?

I had this:

Code: Select all

foreach ($results as $result) {
   $this->data['images'][] = array(
     'popup' => $this->model_tool_image->resize($result['image'].........,
     'thumb' => $this->model_tool_image->resize($result['image']........,
     'alt_text' => $result['alt_text'],
     'title_text' => $result['title_text']
   );
}
And I also tried changing them to 'image_alt_text' and 'image_title_text', but it gives me the error undefined variable... either way.

Newbie

Posts

Joined
Wed Jan 23, 2013 10:50 pm

Post by cosmo » Tue Feb 19, 2013 3:17 pm

That's because it needs to get the image text out of the image array..

Code: Select all

foreach ($results as $result) {
   $this->data['images'][] = array(
     'popup' => $this->model_tool_image->resize($result['image'].........,
     'thumb' => $this->model_tool_image->resize($result['image']........,
     'alt_text' => $result['image']['image_alt_text'],
     'title_text' => $result['image']['image_title_text']
   );
}

New member

Posts

Joined
Sat Apr 10, 2010 3:26 pm

Post by Lundii30 » Tue Feb 19, 2013 10:13 pm

AWESOME! That worked! Thank you so much.

I do have one problem still (had this problem since I uploaded the 5 xml files).. all of my product links on the category pages don't work. When I look at the URL in the address bar it leaves the product id blank like this:

/index.php?route=product/product&path=59&product_id=

and then opens a page that says:
Product not found!
Do you know what I can do about that??
Again, thank you so much for taking the time to get back to me. I really appreciate your help!

Newbie

Posts

Joined
Wed Jan 23, 2013 10:50 pm

Post by cosmo » Wed Feb 20, 2013 1:57 am

Yes, I got another comment about that.
The error is confirmed and I will have a look at it as soon as I get a chance.

New member

Posts

Joined
Sat Apr 10, 2010 3:26 pm

Post by Lundii30 » Wed Feb 20, 2013 3:31 am

Thank you for looking into it.

Newbie

Posts

Joined
Wed Jan 23, 2013 10:50 pm

Post by Lundii30 » Wed Feb 20, 2013 7:31 am

...forgot to mention.. the "add to cart" buttons don't work either on the catalog pages..

Newbie

Posts

Joined
Wed Jan 23, 2013 10:50 pm

Post by cosmo » Wed Feb 20, 2013 11:49 pm

Found the issue, ambigous column names in the image text table and the product table. Both are named 'product_id'.
I will write a migration script for the db-table and update the vqmod-xmls accordingly.

So, today I learned to always specifically prefix your custom database tables!

New member

Posts

Joined
Sat Apr 10, 2010 3:26 pm

Post by cosmo » Thu Feb 21, 2013 12:14 am

Ok, new version.

If previous version installled:

1. Replace all old xmls.
2. Run the migrate_product_image_text.sql (simply renames the product_id column in the custom table).

Keep posting any issues.

Attachments


New member

Posts

Joined
Sat Apr 10, 2010 3:26 pm

Post by Lundii30 » Thu Feb 21, 2013 12:53 am

PERFECT!!! Everthing works now..
when I ran the migrate_product_image_text.sql is gave me the following:
MySQL returned an empty result set (i.e. zero rows). (Query took 0.0072 sec)
But everything seems to be alright.

THANK you so much.

Newbie

Posts

Joined
Wed Jan 23, 2013 10:50 pm

Post by cosmo » Thu Feb 21, 2013 11:45 pm

Aaaaand another version where I've added custom alt and title text to all product presentations
  • category page
  • search page
  • manufaturer page
  • compare page
  • bestseller module
  • featured module
  • latest module
  • special module
All templates needs to be updated accordingly to display the texts.

If previously installed just replace the image_alt_and_title_text_catalog_controller.xml with the one in this package.

Attachments


New member

Posts

Joined
Sat Apr 10, 2010 3:26 pm

Post by timparnell » Thu Apr 18, 2013 2:58 am

Wow, you have just saved me an age of work.
I have created a similar system so you can customise the product and category Page Titles.
My customer asked for this as apparently this is good for SEO... ???
If anyone is interested I can pull it together as a mod and contribute it.
Tim

tim@pointreddesign.co.uk | http://www.pointreddesign.co.uk


User avatar
New member

Posts

Joined
Wed Feb 01, 2012 11:03 pm
Location - Norwich, Norfolk, UK

Post by josephchauhan » Thu Apr 25, 2013 11:08 pm

Can you make it work with 1.5.5.1..... I tried to install but it dosen't work.....
i get this error #1054 - Unknown column 'product_id' in 'product_image_text' when i rum Migrate product image text and the store stops responding...... but then i later figured out that i need to rename Proudct_image_text to oc_product_image_text....

Newbie

Posts

Joined
Fri Apr 19, 2013 5:13 pm

Post by newtress » Mon Jun 17, 2013 5:00 pm

This seems to work like a charm using a highly customized theme on OC version 1.5.5.1 so long as you follow the directions and make sure to make the necessary changes to the Product Template and Product Controller File, as well as the database, including the prefix.

One thing we had to make sure of was that the Alt Tags correspond with the correct pictures in your store, as they may display on the wrong images depending on which you consider the main and which is the additional image. Our theme has a hover effect that changes the popup image, so we have to make sure that the popup image is always considered the main image in the product template file and adjust the alt to reflect that.

While I must commend @Cosmos and all the others on their effort, I have one silly question. If you check out this page of our Developmental Site http://dev.newtress.com/index.php?route ... duct_id=42 site, you will realize that the products all have closing brackets after them. This doesn't appear on other products on the site that do not have Alt Text. Why does this appear now?

Best,

NewTress

Newbie

Posts

Joined
Mon Jun 17, 2013 4:54 pm

Post by cosmo » Mon Jun 17, 2013 6:43 pm

Looks like the template is malformed.
Make sure the img-tag is closed correctly and not before the alt-text-check.

New member

Posts

Joined
Sat Apr 10, 2010 3:26 pm

Post by newtress » Tue Jun 18, 2013 11:45 am

Hey Cosmos,

Turns out it was a spacing issue. When I copied the code the closing tag for the image was too close to the closing tags for the image_alt_text output, so by adding that extra space it fixed everything. Otherwise, great plugin and we will be implementing it on our main hair extensions site http://www.newtress.com today.

Amazing work to this point Cosmos. Why not just bundle the package into an extension on the OpenCart Extensions or do you prefer the intimacy and close knit nature of the forum?

Newbie

Posts

Joined
Mon Jun 17, 2013 4:54 pm

Post by neilrogero » Sat Jul 20, 2013 2:48 pm

How to Add custom alt text to product image?

Newbie

Posts

Joined
Sat Jul 20, 2013 2:03 pm
Who is online

Users browsing this forum: No registered users and 9 guests