I have changed the lastmod format to ('d-m-Y h:i:s') but is still not working? only half of the sitemap feeds have changed?

Please can someone help?
Tuesday, April 12 2016, 03:22 AM
Share this post:

Accepted Answer

Thursday, April 14 2016, 01:03 AM - #Permalink
The code is not showing right here because is not wrapped with code tag so try to implement this one: https://github.com/arastta/arastta/pull/406/files
The reply is currently minimized Show
Responses (33)
  • Accepted Answer

    Tuesday, April 12 2016, 03:43 AM - #Permalink
    For whatever reason the format d-m-Y h:i:s was only used once i change them all now it works.. :) self healing...lol:D
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 04:13 AM - #Permalink
    Although that seems to work it still not accepted by google any help is welcome i need to change it to

    2013-10-21 15:56:22

    should be written

    2013-10-21T15:56:22+2.00 for it to be accepted by google
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 02:32 PM - #Permalink
    It's not easy to follow your writings, but you have changed it in /catalog/view/theme/*/template/feed/google_sitemap.tpl - right?

    Clock time isn't really needed, Google will accept Y-m-d too, last time I tested I used:
            <?php if (isset($result['date'])) { ?>
    <lastmod><?php echo date('Y-m-d', strtotime($result['date'])); ?></lastmod>
    <?php } else { ?>
    <lastmod><?php echo date('Y-m-d'); ?></lastmod>
    <?php } ?>


    But I guess it could also work with something like (not tested):
            <?php if (isset($result['date'])) { ?>
    <lastmod><?php echo date('Y-m-d', strtotime($result['date'])) . 'T' . date('H:i:s', strtotime($result['date'])) . '+2.00'; ?></lastmod>
    <?php } else { ?>
    <lastmod><?php echo date('Y-m-d') . 'T' . date('H:i:s') .'+2.00'; ?></lastmod>
    <?php } ?>


    BUT, I guess that timezone addition (+2.00) is depending on servers timezone. I would skip it ...

    EDIT! Those are the valid formats: https://www.w3.org/TR/NOTE-datetime - but only YYYY-MM-DD is required when using the optional lastmod tag: http://www.sitemaps.org/protocol.html
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 03:37 PM - #Permalink
    Thanks i will try to follow these instructions? i am not sure which one will work, will try everything :)
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 04:16 PM - #Permalink
    The second code had the same result, but the first code came up with this result.

    Warnings
    Invalid XML: too many tags
    Too many tags describing this tag. Please fix it and resubmit.
    52

    Any ideas?
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 04:19 PM - #Permalink
    Post your file ...
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 04:29 PM - #Permalink
    I will send a screen shot
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 04:32 PM - #Permalink
    Now i get this error??

    Errors
    Error
    We encountered an error while trying to access your Sitemap. Please ensure your Sitemap follows our guidelines and can be accessed at the location you provided and then resubmit.
    1
    Network unreachable: Network unreachable
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 04:33 PM - #Permalink
    Post your file (code), not link to your sitemap.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 04:41 PM - #Permalink
    '; ?>









    weekly



    1.0










    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 04:43 PM - #Permalink
    You can't see it?
    Attachments:
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 04:52 PM - #Permalink
    To post code, you need to use the code tag around it (found in the toolbar for the text field).



    If you use caching in site or server, remember to flush it before testing changes!
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 05:37 PM - #Permalink
    OK Looking now :) but it is not what google is saying?



    Errors
    Invalid date
    An invalid date was found. Please fix the date or formatting before resubmitting.
    52
    Parent tag: url
    Tag: lastmod
    Value: 2016-04-12 01:26:20
    4
    Apr 12, 2016
    Parent tag: url
    Tag: lastmod
    Value: 2016-04-12 01:26:20
    15
    Apr 12, 2016
    Parent tag: url
    Tag: lastmod
    Value: 2016-04-12 01:26:20
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 05:39 PM - #Permalink
    1

    /index.php?route=feed/google_sitemap
    Sitemap
    Pending
    52 errors
    Web
    52
    5
    Images
    12
    -
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 05:43 PM - #Permalink
    If the file you posted is located in the template you are using, you would not get that output including time, as it doesn’t exist in that file - according to you.

    Oh, and there is no times in that link you posted earlier:

    So I really don't have any clue about what you actually are doing ...
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 05:58 PM - #Permalink
    Try

    <lastmod> . date('c', strtotime($result['date_modified'])) . </lastmod>
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 06:04 PM - #Permalink
    Something is not right with that code?

    Thanks :)
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 06:04 PM - #Permalink
    Something is not right with that code?

    Thanks :)
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 06:08 PM - #Permalink
    Bobby winters wrote:

    Something is not right with that code?

    Thanks :)

    Do you try that code above?
    As reference, you can check link below
    function date php
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 06:12 PM - #Permalink
    Sorry i am not joking it does not recognize it as complete
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 06:14 PM - #Permalink
    Me too, not joking
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 06:23 PM - #Permalink
    Sorry guys this is getting confusing? I am not understanding why we are going back and forth on this issue? I have given the code being used, and it is not working on google sitemaps, it comes up with errors?

    This is the sitemap that comes with the community software, if it does not work why did they include it? i have not changed anything just added products.

    Please can someone just tell me why google says it has errors and what can be done

    Thanks:)
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 06:28 PM - #Permalink
    The code in your screenshot works, and the url you posted works.
    The code of Aris can not work as it is, if used like this it should be:
            <?php if (isset($result['date'])) { ?>
    <lastmod><?php echo date('c', strtotime($result['date'])); ?></lastmod>
    <?php } else { ?>
    <lastmod><?php echo date('c'); ?></lastmod>
    <?php } ?>


    What you are doing to get it wrong, I have no clue about. That is something you need someone to look at in your system, I guess ...
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 06:32 PM - #Permalink
    I can not see anymore of this conversation?
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 06:57 PM - #Permalink
    Who can look at the system? and if you look at the test you did it has the same errors as google.. 1 warring, but with that one warning google doesn't want to except.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, April 12 2016, 07:06 PM - #Permalink
    No it's not the same warning, far from it according to your postings here ...
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, April 13 2016, 01:09 AM - #Permalink
    OK please explain that warning maybe it's the same?
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, April 13 2016, 03:42 PM - #Permalink
    What warning do you see?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, April 14 2016, 03:03 PM - #Permalink
    Thank you for your response :) That looks like it might work, but now i can't see because google cant' fetch pages or retrieve my site map, because of all of this hassle? i now get this message

    Network unreachable: robots.txt unreachable We were unable to crawl your Sitemap because we found a robots.txt file at the root of your site but were unable to download it. Please ensure that it is accessible or remove it completely.

    but not sure why, it is on the server, my hosting says it is not being blocked?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, April 14 2016, 06:58 PM - #Permalink
    All working now Thank you so much for everyone's input :) :) :) :) :) :)
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, April 17 2016, 04:45 PM - #Permalink
    Bobby here is the solution I've made and work. I've posted the problem long time ago.

    Redue all changes you've made to the the source and upload following script n "OCMODE" and click the refresh link at the top:

    <?xml version="1.0" encoding="utf-8"?>

    <modification>

    <id></id>

    <name>Fix-Google-Sitemap</name>

    <code>Fix-Google-Sitemap</code>

    <version>1</version>

    <author>Hermann</author>

    <file path="catalog/view/theme/default/template/feed/google_sitemap.tpl">

    <operation>

    <search><![CDATA[echo $result['date'];]]></search>

    <add position="replace"><![CDATA[$datetime = new DateTime($result['date']);

    echo $datetime->format('Y-m-d\TH:i:sP');]]></add>

    </operation>

    <operation>

    <search><![CDATA[echo date('Y-m-d H:i:s');]]></search>

    <add position="replace"><![CDATA[$datetime = new DateTime(date('Y-m-d'));

    echo $datetime->format('Y-m-d\TH:i:sP');]]></add>

    </operation>

    </file>

    </modification>
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, April 17 2016, 04:50 PM - #Permalink
    Hi Bobby, re-due all changes and use following OCMODE script:

    <?xml version="1.0" encoding="utf-8"?>

    <modification>

    <id></id>

    <name>Fix-Google-Sitemap</name>

    <code>Fix-Google-Sitemap</code>

    <version>1</version>

    <author>Hermann</author>

    <file path="catalog/view/theme/default/template/feed/google_sitemap.tpl">

    <operation>

    <search><![CDATA[echo $result['date'];]]></search>

    <add position="replace"><![CDATA[$datetime = new DateTime($result['date']);

    echo $datetime->format('Y-m-d\TH:i:sP');]]></add>

    </operation>

    <operation>

    <search><![CDATA[echo date('Y-m-d H:i:s');]]></search>

    <add position="replace"><![CDATA[$datetime = new DateTime(date('Y-m-d'));

    echo $datetime->format('Y-m-d\TH:i:sP');]]></add>

    </operation>

    </file>

    </modification>
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, April 17 2016, 05:17 PM - #Permalink
    Hermann, this tread is marked solved - and it's also changed in core at GitHub. ;)

    Btw! Where did you post the problem and fix long time ago? Not at GitHub I guess?!
    The reply is currently minimized Show
Your Reply