Page 4 of 5 FirstFirst ... 2345 LastLast
Results 31 to 40 of 42
  1. #31
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: Google Trusted Stores program

    Does anyone know how to conditionally show this code
    HTML Code:
    <?php echo $products_model; ?>
    ONLY when it's a product page otherwise to leave the value blank. Thanks!

  2. #32
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Google Trusted Stores program

    Quote Originally Posted by BlessIsaacola View Post
    Does anyone know how to conditionally show this code
    HTML Code:
    <?php echo $products_model; ?>
    ONLY when it's a product page otherwise to leave the value blank. Thanks!
    I'm not sure I understand the question. Is this specifically related to the Google Trusted Stores topics being discussed above?

    Also, if you're not on a product-page, then $products_model would already be blank, and thus nothing would display. So, it's moot.

    I think there's a lot more "context" behind your question, and that's needed information before a proper answer can be given to the real issue you're trying to address.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #33
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: Google Trusted Stores program

    Quote Originally Posted by DrByte View Post
    I'm not sure I understand the question. Is this specifically related to the Google Trusted Stores topics being discussed above?

    Also, if you're not on a product-page, then $products_model would already be blank, and thus nothing would display. So, it's moot.

    I think there's a lot more "context" behind your question, and that's needed information before a proper answer can be given to the real issue you're trying to address.
    Thanks for your response DrByte! Yes my question was in relation to the Google Trusted Store only. I am trying to pass a variable for this:
    HTML Code:
    gts.push(["google_base_offer_id", "ITEM_GOOGLE_SHOPPING_ID"]);
    We used the model_id from our site currently for google shopping id (which is why I am trying to figure out how to pass it with the code I posted).

    Thanks!

  4. #34
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Google Trusted Stores program

    You asked about how to do something "only" if it's on the product page.
    This PHP code will handle that condition:

    Code:
    <?php if ($current_page_base == FILENAME_PRODUCT_INFO) { ?>
       //put your custom html/script code here
    <?php } ?>
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #35
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: Google Trusted Stores program

    Quote Originally Posted by DrByte View Post
    You asked about how to do something "only" if it's on the product page.
    This PHP code will handle that condition:

    Code:
    <?php if ($current_page_base == FILENAME_PRODUCT_INFO) { ?>
       //put your custom html/script code here
    <?php } ?>
    Thanks for the prompt response and code. Does FILENAME_PRODUCT_INFO in the above code means this will only work when on regular product page but not on product pages that use product type: music?

    Thanks!

  6. #36
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Google Trusted Stores program

    Yes. You could change it to reflect the other constant, or you could add multiple possibilities with normal PHP 'or' logic. Or you could change it to something like:
    Code:
    if (preg_match('/^product_.*?info$/', $current_page_base)) { ...
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #37
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: Google Trusted Stores program

    Quote Originally Posted by DrByte View Post
    Yes. You could change it to reflect the other constant, or you could add multiple possibilities with normal PHP 'or' logic. Or you could change it to something like:
    Code:
    if (preg_match('/^product_.*?info$/', $current_page_base)) { ...
    Thank you! I will give it a try and see what happens :)

  8. #38
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: Google Trusted Stores program

    I need help cleaning up the badge code: This is what I have:
    Code:
    <!-- BEGIN: Google Trusted Stores -->
    <script type="text/javascript">
      var gts = gts || [];
    
      gts.push(["id", "11100"]);
    <?php if (isset($_GET['products_id'])) { ?>  
    gts.push(["google_base_offer_id", "<?php echo $products_model; ?>"]);
    <?php 
      }
    ?>
      gts.push(["google_base_subaccount_id", "144444"]);
      gts.push(["google_base_country", "US"]);
      gts.push(["google_base_language", "en"]);
    
      (function() {
        var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
        var gts = document.createElement("script");
        gts.type = "text/javascript";
        gts.async = true;
        gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(gts, s);
      })();
    </script>
    <!-- END: Google Trusted Stores -->
    The above code works on product page and it insert the Model ID where I want it. However, on non-product page, I still want this line of code:
    Code:
    gts.push(["google_base_offer_id", "ITEM_GOOGLE_SHOPPING_ID"]);
    only with an empty value. Basically, want a situation to tell the code to display Model ID when the url have product ID but when it's any other page show the Model ID as empty.
    Thanks!

  9. #39
    Join Date
    Feb 2004
    Location
    Georgia, USA
    Posts
    1,948
    Plugin Contributions
    0

    Default Re: Google Trusted Stores program

    Not sure if this is the most efficient way to do this but I finally have the badge code working and it passed Google's test. Here is my complete code:
    Code:
    <!-- BEGIN: Google Trusted Stores -->
    <script type="text/javascript">
      var gts = gts || [];
    
      gts.push(["id", "11100"]); Replace with your ID
    <?php if (isset($_GET['products_id'])) { ?>  
      gts.push(["google_base_offer_id", "<?php echo $products_model; ?>"]);
    <?php 
      }
    ?>
    <?php if (!isset($_GET['products_id'])) { ?>  
      gts.push(["google_base_offer_id", ""]);
    <?php 
      }
    ?>
      gts.push(["google_base_subaccount_id", "144444"]); Replace with your ID
      gts.push(["google_base_country", "US"]);
      gts.push(["google_base_language", "en"]);
    
      (function() {
        var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
        var gts = document.createElement("script");
        gts.type = "text/javascript";
        gts.async = true;
        gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(gts, s);
      })();
    </script>
    <!-- END: Google Trusted Stores -->
    I am sure the Model ID could have been handled with if else statement but what I tried didn't work.
    Last edited by BlessIsaacola; 19 Aug 2013 at 02:00 AM. Reason: Clarification

  10. #40
    Join Date
    May 2007
    Location
    Montebello, CA
    Posts
    40
    Plugin Contributions
    0

    Default Re: Google Trusted Stores program

    Nice thank you it works for me by adding the merchant code feed...


    Quote Originally Posted by BlessIsaacola View Post
    Not sure if this is the most efficient way to do this but I finally have the badge code working and it passed Google's test. Here is my complete code:
    Code:
    <!-- BEGIN: Google Trusted Stores -->
    <script type="text/javascript">
      var gts = gts || [];
    
      gts.push(["id", "11100"]); Replace with your ID
    <?php if (isset($_GET['products_id'])) { ?>  
      gts.push(["google_base_offer_id", "<?php echo $products_model; ?>"]);
    <?php 
      }
    ?>
    <?php if (!isset($_GET['products_id'])) { ?>  
      gts.push(["google_base_offer_id", " XXXXX "]);  <------  Add the code you get on Google merchants when submitting your feed. 
    <?php 
      }
    ?>
      gts.push(["google_base_subaccount_id", "144444"]); Replace with your ID
      gts.push(["google_base_country", "US"]);
      gts.push(["google_base_language", "en"]);
    
      (function() {
        var scheme = (("https:" == document.location.protocol) ? "https://" : "http://");
        var gts = document.createElement("script");
        gts.type = "text/javascript";
        gts.async = true;
        gts.src = scheme + "www.googlecommerce.com/trustedstores/gtmp_compiled.js";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(gts, s);
      })();
    </script>
    <!-- END: Google Trusted Stores -->
    I am sure the Model ID could have been handled with if else statement but what I tried didn't work.
    https://www.tni-wireless.com

    Zen Cart V1.5.4 with Tableau Responsive Theme.

 

 
Page 4 of 5 FirstFirst ... 2345 LastLast

Similar Threads

  1. v151 Google Trusted Site Plugin
    By Semenek in forum All Other Contributions/Addons
    Replies: 2
    Last Post: 21 Nov 2015, 05:46 PM
  2. v151 Google Trusted Site
    By WWWD in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 14 Mar 2013, 06:04 PM
  3. 2 stores stores, 1 backend and database?
    By globallink in forum General Questions
    Replies: 2
    Last Post: 27 Nov 2008, 07:56 AM
  4. Replies: 2
    Last Post: 18 Jul 2008, 01:30 PM

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