Page 1 of 3 123 LastLast
Results 1 to 10 of 79

Hybrid View

  1. #1
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Google Product Search Feeder II [Support Thread]

    These PHP extension classes are new to me, but as I wanted to create a custom product_type (I used 666 as a test) for category 66 I used this code in a new classes file (includes/classes/gpsf/gpsfKb.php):

    PHP Code:
    <?php
    /**
     */
    class gpsfKb extends gpsfBase
    {
        public function 
    getProductsAttributes(string $products_id, array $product, array $categories_list$cPath '66', array $custom_fields): array
        {
            
    $extension_custom_fields = ['product_type' => '666',];

            return 
    $extension_custom_fields;
        }
    }
    This works in that it adds the product_type to the feed,
    Code:
    <g:product_type>666</g:product_type>
    <g:product_type><![CDATA[Gift Vouchers]]></g:product_type>
    I would appreciate some guidance on the code changes needed to replace the already generated product_type rather than add a new one.

    I think that this plugin's 'site-specific additions to a product feed' is going to be a stretch for most non-coders, like me, so hopefully this example will get the ball rolling.
    Simon

  2. #2
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Google Product Search Feeder II [Support Thread]

    Actually, what I've done hasn't worked as it adds the '666' to all products. Back to the drawing board.
    Simon

  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,873
    Plugin Contributions
    96

    Default Re: Google Product Search Feeder II [Support Thread]

    Quote Originally Posted by simon1066 View Post
    Actually, what I've done hasn't worked as it adds the '666' to all products. Back to the drawing board.
    Right, you'd need to check the incoming $products_id value and possibly the $product/$categories_list/$cPath arrays to see if the current product 'qualifies' for the change.

    For what I think you're trying to do:
    PHP Code:
    public function getProductsAttributes(string $products_id, array $product, array $categories_list, array $cPath, array $custom_fields): array 
        {
            if (!
    in_array(66$cPath)) {
                return [];
            }
            
    $extension_custom_fields = ['product_type' => '666',]; 

            return 
    $extension_custom_fields
        } 
    That checks to see if categories-id 66 is present in the current product's category-tree, returning the 'product_type' override if so; otherwise, no override is supplied.

  4. #4
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Google Product Search Feeder II [Support Thread]

    Quote Originally Posted by lat9 View Post
    Right, you'd need to check the incoming $products_id value and possibly the $product/$categories_list/$cPath arrays to see if the current product 'qualifies' for the change.

    For what I think you're trying to do:
    PHP Code:
    public function getProductsAttributes(string $products_id, array $product, array $categories_list, array $cPath, array $custom_fields): array 
        {
            if (!
    in_array(66$cPath)) {
                return [];
            }
            
    $extension_custom_fields = ['product_type' => '666',]; 

            return 
    $extension_custom_fields
        } 
    That checks to see if categories-id 66 is present in the current product's category-tree, returning the 'product_type' override if so; otherwise, no override is supplied.
    That's great, thanks so much for the pointer/correction.
    Simon

  5. #5
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,873
    Plugin Contributions
    96

    Default Re: Google Product Search Feeder II [Support Thread]

    Quote Originally Posted by simon1066 View Post
    These PHP extension classes are new to me, but as I wanted to create a custom product_type (I used 666 as a test) for category 66 I used this code in a new classes file (includes/classes/gpsf/gpsfKb.php):

    PHP Code:
    <?php
    /**
     */
    class gpsfKb extends gpsfBase
    {
        public function 
    getProductsAttributes(string $products_id, array $product, array $categories_list$cPath '66', array $custom_fields): array
        {
            
    $extension_custom_fields = ['product_type' => '666',];

            return 
    $extension_custom_fields;
        }
    }
    This works in that it adds the product_type to the feed,
    Code:
    <g:product_type>666</g:product_type>
    <g:product_type><=!=[=C=D=A=T=A=[Gift Vouchers]=]=></g:product_type>
    I would appreciate some guidance on the code changes needed to replace the already generated product_type rather than add a new one.

    I think that this plugin's 'site-specific additions to a product feed' is going to be a stretch for most non-coders, like me, so hopefully this example will get the ball rolling.
    At this point, the gpsfFeedGenerator class doesn't acknowledge an override for the product_type, using either a fixed value or a selection from the product's master-category's name 'tree'. I've created a change-request (https://github.com/lat9/gpsf/issues/11) on the GPSF GitHub repository.

  6. #6
    Join Date
    Feb 2009
    Location
    UK
    Posts
    1,303
    Plugin Contributions
    1

    Default Re: Google Product Search Feeder II [Support Thread]

    Quote Originally Posted by lat9 View Post
    At this point, the gpsfFeedGenerator class doesn't acknowledge an override for the product_type, using either a fixed value or a selection from the product's master-category's name 'tree'. I've created a change-request (https://github.com/lat9/gpsf/issues/11) on the GPSF GitHub repository.
    Understood.
    Simon

  7. #7
    Join Date
    Aug 2004
    Posts
    817
    Plugin Contributions
    0

    Default Re: Google Product Search Feeder II [Support Thread]

    Cindy - Excited to try this one out! I just put it on our site but I'm seeing the following debug error on ALL the products:

    Code:
    Array
    (
        [20361] => # SELFIE by Simon R. Stefan & Alex Pandrea - Trick: title cannot be empty
        [25185] => #Augmented (Gimmick and Online Instructions) by Luca Volpe and Renato Cotini - Trick: title cannot be empty
        [21745] => #How by Magic from Holland and Ferry de Riemer - Trick: title cannot be empty
        [35629] => $1.00 Prop Bill (1 bill/$1.00 value) - Realistic Fake Money: title cannot be empty
        [35623] => $10.00 Prop Bill (1 bill/$10.00 value) - Realistic Fake Money: title cannot be empty
        [24025] => $100 bill Silk 36 inch by Magic by Gosh - Trick: title cannot be empty
        [12237] => $100 Bill Switch - Booklet + Gimmick by Royal Magic: title cannot be empty
    .....
    .....
    Any idea what I should be looking at to resolve this?
    - Jeff

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,873
    Plugin Contributions
    96

    Default Re: Google Product Search Feeder II [Support Thread]

    Quote Originally Posted by Jeff_Mash View Post
    Cindy - Excited to try this one out! I just put it on our site but I'm seeing the following debug error on ALL the products:

    Code:
    Array
    (
        [20361] => # SELFIE by Simon R. Stefan & Alex Pandrea - Trick: title cannot be empty
        [25185] => #Augmented (Gimmick and Online Instructions) by Luca Volpe and Renato Cotini - Trick: title cannot be empty
        [21745] => #How by Magic from Holland and Ferry de Riemer - Trick: title cannot be empty
        [35629] => $1.00 Prop Bill (1 bill/$1.00 value) - Realistic Fake Money: title cannot be empty
        [35623] => $10.00 Prop Bill (1 bill/$10.00 value) - Realistic Fake Money: title cannot be empty
        [24025] => $100 bill Silk 36 inch by Magic by Gosh - Trick: title cannot be empty
        [12237] => $100 Bill Switch - Booklet + Gimmick by Royal Magic: title cannot be empty
    .....
    .....
    Any idea what I should be looking at to resolve this?
    Are you using products' meta-tag titles as the g:title? The value's either a product's name (which, for above isn't empty) or the metatags_title.

    I might see the issue, darn it. /includes/classes/gpsfFeedGenerator.php, line 280, change from

    if (GPSF_META_TITLE === 'true' && $product['metatags_title'] !== '') {

    to

    if (GPSF_META_TITLE === 'true' && !empty($product['metatags_title'])) {

    ... and let me know if that corrects the issue. That darn metatags_title can be null.

  9. #9
    Join Date
    Aug 2004
    Posts
    817
    Plugin Contributions
    0

    Default Re: Google Product Search Feeder II [Support Thread]

    Quote Originally Posted by lat9 View Post
    Are you using products' meta-tag titles as the g:title? The value's either a product's name (which, for above isn't empty) or the metatags_title.

    I might see the issue, darn it. /includes/classes/gpsfFeedGenerator.php, line 280, change from

    if (GPSF_META_TITLE === 'true' && $product['metatags_title'] !== '') {

    to

    if (GPSF_META_TITLE === 'true' && !empty($product['metatags_title'])) {

    ... and let me know if that corrects the issue. That darn metatags_title can be null.
    BINGO! That fixed the issue!
    - Jeff

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,873
    Plugin Contributions
    96

    Default Re: Google Product Search Feeder II [Support Thread]

    Quote Originally Posted by Jeff_Mash View Post
    BINGO! That fixed the issue!
    Thanks for the validation; I'll get a GitHub issue logged.

    GitHub issue: https://github.com/lat9/gpsf/issues/12
    Last edited by lat9; 21 Nov 2023 at 02:24 AM. Reason: Add GitHub issue

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. v150 Google Merchant Center Feeder for ZC v1.5.x [Support Thread]
    By DivaVocals in forum Addon Admin Tools
    Replies: 504
    Last Post: 19 Nov 2024, 03:50 PM
  2. Google Base Feeder Support Thread [OLD]
    By numinix in forum All Other Contributions/Addons
    Replies: 3562
    Last Post: 2 Apr 2012, 06:30 PM
  3. Search Helper Support Thread
    By swguy in forum All Other Contributions/Addons
    Replies: 18
    Last Post: 9 Nov 2011, 11:14 AM
  4. Windows Live Product Search Contribution Support Thread
    By numinix in forum All Other Contributions/Addons
    Replies: 209
    Last Post: 3 Jul 2009, 08:23 PM

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