Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Schema Markup Language

    Zen Cart Version 1.5.7c
    Php Version 7.3.33

    My Schema coding is hardcoded into my website rather than a plugin because it pre-dates any plugins.

    The code worked well for many years until recently but whilst using the product ContentKing there is an error saying that the code for my schema parameter "Image" is pointing to the relative url of the image rather than the absolute url.

    Also, in the last few days Ive notice Google is not always using my own images. Sometimes Google puts in other peoples photos taken at their home or trade photos.

    Im not a coder and I understand now what it is saying ... that Im pointing to https://www.tidytoys.co.uk/images/M150 6563.jpg
    rather than https://www.tidytoys.co.uk/bmz_cache...ge.182x136.jpg

    My current code is in includes/templates/responsive_classic/templates/tpl_product_info_display.php
    and the line is currently

    "image": [ "<?php echo HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $products_image; ?>" ] ,

    Please could you tell me what I need to change the code to so I pick up the relative url instead.

    Thank you in advance.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,338
    Plugin Contributions
    94

    Default Re: Schema Markup Language

    What size (small, medium or large) image do you want to reference in that section of the code? From your example, it looks like a 'medium' image, but I want to make sure before I provide additional updates.

  3. #3
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Schema Markup Language

    Thank you for replying.

    I dont know. How would I make that decision ? I really am very unknowledgeable.

  4. #4
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Schema Markup Language

    <script type="application/ld+json">
    {
    "@context": "http://schema.org/",
    "@type": "Product",
    "name": "<?php echo $products_name; ?>",

    <?php if ($products_description != '') { ?>
    "description": "<?php echo META_TAG_DESCRIPTION; ?>",
    <?php } ?>

    "image": [ "<?php echo HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $products_image; ?>" ] ,
    "mpn": "<?php echo $products_model; ?>",
    "sku": "<?php echo $products_model; ?>",
    "color": "<?php echo $color; ?>",
    "brand": {
    "@type": "Brand",
    "name": "<?php echo $manufacturers_name; ?>"
    },

  5. #5
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Schema Markup Language

    I have IH5 installed (latest version)

    If I look at the image for this product ... The small and medium are the same 182x136 and the large is 732x550

    Im not sure if that answers the question.

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,338
    Plugin Contributions
    94

    Default Re: Schema Markup Language

    Changing the code fragment previously posted to the following will include the IH5 product's large image for that "image" element:

    Code:
    <script type="application/ld+json">
    {
    "@context": "http://schema.org/",
    "@type": "Product",
    "name": "<?php echo $products_name; ?>",
    
    <?php if ($products_description != '') { ?>
    "description": "<?php echo META_TAG_DESCRIPTION; ?>",
    <?php } ?>
    <?php
    if (!defined('IH_RESIZE') || IH_RESIZE !== 'yes') {
        $products_image = HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $products_image;
    } else {
        list($products_image) = handle_image(DIR_WS_IMAGES . $products_image, '', LARGE_IMAGE_MAX_WIDTH, LARGE_IMAGE_MAX_HEIGHT, '');
        $products_image = HTTP_SERVER . DIR_WS_CATALOG . $products_image;
    }
    ?>
    "image": [ "<?php echo $products_image; ?>" ] ,
    "mpn": "<?php echo $products_model; ?>",
    "sku": "<?php echo $products_model; ?>",
    "color": "<?php echo $color; ?>",
    "brand": {
    "@type": "Brand",
    "name": "<?php echo $manufacturers_name; ?>"
    },

  7. #7
    Join Date
    Oct 2008
    Location
    Croatia
    Posts
    1,616
    Plugin Contributions
    19

    Default Re: Schema Markup Language

    Why are you putting the image URL in brackets? According to schema.org, the image property doesn't need brackets when you're submitting a single image.

    So, IMHO, the correct code would be
    Code:
    "image": "<?php echo HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . $products_image; ?>",
    Also, even though lat9's solution is technically correct, I would not use it unless you're uploading images larger than 1920x1080px as the main product image. Why would you point to a resized image? Although there's no specific information on product's schema requirements, I'd prefer pointing to the best possible image I can offer. And besides, you really shouldn't be uploading 4k pics in the first place - the original pic shouldn't be more than 1200x1200 px (and optimized, of course) so you should be fine.

    And last, but not least - I ran the product you mentioned through Google Rich Results test and it's not showing any errors... Maybe ContentKing is using something from cache or is messing with you or something, but your Rich Snippets seem to be just fine.

  8. #8
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Schema Markup Language

    Thank you lat9,

    I tried the code you kindly gave me, but my image disappeared from the product description page.

  9. #9
    Join Date
    Jun 2008
    Location
    UK
    Posts
    209
    Plugin Contributions
    0

    Default Re: Schema Markup Language

    Balihr,

    I cant comment on the code. I know nothing about php, css or html.
    Years ago I was probably one of the first people to put schema code onto my website based on a document that a lady called Michelle ?!
    had created. Even then I had trouble getting the image to work.

    Its hard to explain but I muddle my way through everything and use guesswork.
    I do have an IT background in Cobol !
    And Ive recently started an IT degree and have started learning Python.
    Just assume I have zero knowledge.
    Luckily my website hardly needs changing.
    Yesterday I upgraded IH from 5.2 to the latest version, but do it by manually cutting and pasting the contents into every file.
    I dont particularly like using Filezilla, but maybe because like everything here I just stumble around.

  10. #10
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,842
    Plugin Contributions
    11

    Default Re: Schema Markup Language

    Quote Originally Posted by toyseller View Post
    I do have an IT background in Cobol !
    common business oriented language? the horror...

    learn git. put your site under version control. it will eliminate the need for filezilla most of the time.

    in addition, git will come in handy for your python projects...

    best.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v155 Structured Data Markup for Schema, Facebook Open Graph, Twitter...
    By torvista in forum Addon Admin Tools
    Replies: 196
    Last Post: 14 Jan 2025, 12:42 PM
  2. Replies: 13
    Last Post: 27 Jun 2019, 05:31 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR