Forums / All Other Contributions/Addons / AutoFacebook [Support]

AutoFacebook [Support]

Views: 141,424

Results 621 to 640 of 691
28 Oct 2013, 11:53 PM
#621
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Location:
Adelaide, Australia
Posts:
1,684
Plugin Contributions:
0

AutoFacebook [Support]

shags38:

likely a dumb question - I have used a few versions of AutoFacebook so not sure which plugin has the feature which allows you to say yes update or no do not update Facebook when you add a new product or modify a new product. Any help will be appreciated. I am using v1.3.9h

cheers,
Mike

I was right - it was a dumb question - I cleared the fog in my brain and remembered that LankeeYankee had sorted this out for me previously - thanks Yankee :smile:

30 Oct 2013, 6:36 AM
#622
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Location:
Adelaide, Australia
Posts:
1,684
Plugin Contributions:
0

Re: AutoFacebook [Support]

Hi Yankee - like a few others I'd like to know how to limit the number of decimal points showing in the price when Facebook is updated - I think it is a Zen Cart thing (as against an AutoFacebook thing) as when updating a product it is showing as 4 digits after the decimal point instead of 2 in the net price window on the product page - if I remember to remove the two extra digits before hitting update it works fine but it is difficult to keep remembering that when doing a lot of product maintenance.

Any help is appreciated.

cheers,
Mike

12 Nov 2013, 6:15 AM
#623
stellarweb avatar

stellarweb

Zen Follower

Join Date:
May 2006
Location:
Montana
Posts:
293
Plugin Contributions:
8

Re: AutoFacebook [Support]

Mike - look in the downloads section for a new revision that fixes this issue. I just installed it and it works GREAT!!

Now I just want to figure out how to implement the code in this thread to put a "switch" on the product page so things are only posted if you click that switch.

shags38:

Hi Yankee - like a few others I'd like to know how to limit the number of decimal points showing in the price when Facebook is updated - I think it is a Zen Cart thing (as against an AutoFacebook thing) as when updating a product it is showing as 4 digits after the decimal point instead of 2 in the net price window on the product page - if I remember to remove the two extra digits before hitting update it works fine but it is difficult to keep remembering that when doing a lot of product maintenance.

Any help is appreciated.

cheers,
Mike

12 Nov 2013, 6:28 AM
#624
shags38 avatar

shags38

Totally Zenned

Join Date:
Jan 2011
Location:
Adelaide, Australia
Posts:
1,684
Plugin Contributions:
0

Re: AutoFacebook [Support]

Hi Judy,

stellarweb:

Mike - look in the downloads section for a new revision that fixes this issue. I just installed it and it works GREAT!! What revision? a revision of AutoFacebook or some other plugin? can you elaborate please as I am keen to get this fixed.

Now I just want to figure out how to implement the code in this thread to put a "switch" on the product page so things are only posted if you click that switch. So do you need help with this or was this just a comment :) ? I have it working beautifully on the product info page, update facebook yes or no radio button.

cheers,
Mike

12 Nov 2013, 4:40 PM
#625
stellarweb avatar

stellarweb

Zen Follower

Join Date:
May 2006
Location:
Montana
Posts:
293
Plugin Contributions:
8

Re: AutoFacebook [Support]

shags38:

Hi Judy,

What revision? a revision of AutoFacebook or some other plugin? can you elaborate please as I am keen to get this fixed.

So do you need help with this or was this just a comment :) ? I have it working beautifully on the product info page, update facebook yes or no radio button.

cheers,
Mike

Mike - I downloaded the latest version of AutoFacebook that came out a few days ago that fixes the decimal point issue.
http://www.zen-cart.com/downloads.php?do=file&id=1095

It took just a few minutes to get the radio button working - very slick! I think it needs to be packaged up and added to the mod! It is definitely something the mod needs. :smile:

14 Nov 2013, 9:43 AM
#626
zch0071 avatar

zch0071

New Zenner

Join Date:
Jun 2009
Posts:
9
Plugin Contributions:
0

Re: AutoFacebook [Support]

Hi,
I need help.
I have used autofacebook plug-in to upload the products information to facebook, but the pictures on facebook are completely inconformity from the website. The facebook has resized the pictures a lot and the pictures looks very twisted.
facebook info:
Attachment 13350
Product info:
Attachment 13351

how to fix?

25 Dec 2013, 11:35 AM
#627
alhakeem2001 avatar

alhakeem2001

Zen Follower

Join Date:
Nov 2007
Posts:
434
Plugin Contributions:
1

Re: AutoFacebook [Support]

Guys, Is anybody there having the same problem I have ? After I installed the plugin, I wanted to test it, so I added a test product to see if it will be updated on facebook, but after I added the new product then preview > update >> Oops .. then I got a blank page ! why is that ? the logs shows those errors :

**
[25-Dec-2013 04:23:32] PHP Warning: Cannot modify header information - headers already sent by (output started at /home1/public_html/newadmin/includes/modules/update_product.php:1) in /home1/public_html/newadmin/includes/functions/general.php on line 21**

I'm using zc v.1.5.1 on Firefox,Google chrome, IE !! Please help ..

1 Jan 2014, 11:29 PM
#628
tenthilltoys avatar

tenthilltoys

New Zenner

Join Date:
Aug 2013
Location:
Brisbane
Posts:
25
Plugin Contributions:
0

Re: AutoFacebook [Support]

Hi

I have just installed the Numinix product fields into my store. I am having trouble with the collect info as I have it modified for Auto Facebook (works fine) when getting to the product>XXX>XXXX screen it goes blank.

Is anyone using this combination of Modules.

I have been over both files and cannot see any mistakes as I merged these files.

Thanks
Peter

2 Jan 2014, 3:08 AM
#629
sammirah avatar

sammirah

Zen Follower

Join Date:
Apr 2012
Location:
Los Angeles, CA
Posts:
185
Plugin Contributions:
2

Re: AutoFacebook [Support]

I am having the same problem, has anyone replied to your post about this yet?

2 Jan 2014, 4:06 AM
#630
sammirah avatar

sammirah

Zen Follower

Join Date:
Apr 2012
Location:
Los Angeles, CA
Posts:
185
Plugin Contributions:
2

Re: AutoFacebook [Support]

alhakeem2001:

Guys, Is anybody there having the same problem I have ? After I installed the plugin, I wanted to test it, so I added a test product to see if it will be updated on facebook, but after I added the new product then preview > update >> Oops .. then I got a blank page ! why is that ? the logs shows those errors :

**
[25-Dec-2013 04:23:32] PHP Warning: Cannot modify header information - headers already sent by (output started at /home1/public_html/newadmin/includes/modules/update_product.php:1) in /home1/public_html/newadmin/includes/functions/general.php on line 21**

I'm using zc v.1.5.1 on Firefox,Google chrome, IE !! Please help ..

Ok so I just installed this mod tonight and was having the same issue. To fix it download a copy of your back up of the admin-->includes-->modules-->update_product.php file then use Winmerge to merge the copy of the modules update_product.php file, save the new file and make the changes to the mod information and upload it to your server (replace the old file) and it should work.

Not sure if I have other mods that have updated this file but here is a copy of the merge I made or rather here is the code to replace the old file with

<?php
/**
 * @package admin
 * @copyright Copyright 2003-2011 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: update_product.php 18695 2011-05-04 05:24:19Z drbyte $
 */
  if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
  }
  if (isset($_GET['pID'])) $products_id = zen_db_prepare_input($_GET['pID']);
  if (isset($_POST['edit_x']) || isset($_POST['edit_y'])) {
    $action = 'new_product';
  } elseif ($_POST['products_model'] . $_POST['products_url'] . $_POST['products_name'] . $_POST['products_description'] != '') {
    $products_date_available = zen_db_prepare_input($_POST['products_date_available']);

    $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

    // Data-cleaning to prevent MySQL5 data-type mismatch errors:
    $tmp_value = zen_db_prepare_input($_POST['products_quantity']);
    $products_quantity = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['products_price']);
    $products_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['products_weight']);
    $products_weight = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['manufacturers_id']);
    $manufacturers_id = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;

    $sql_data_array = array('products_quantity' => $products_quantity,
                            'products_type' => zen_db_prepare_input($_GET['product_type']),
                            'products_model' => zen_db_prepare_input($_POST['products_model']),
                            'products_price' => $products_price,
                            'products_date_available' => $products_date_available,
                            'products_weight' => $products_weight,
                            'products_status' => zen_db_prepare_input((int)$_POST['products_status']),
                            'products_virtual' => zen_db_prepare_input((int)$_POST['products_virtual']),
                            'products_tax_class_id' => zen_db_prepare_input((int)$_POST['products_tax_class_id']),
                            'manufacturers_id' => $manufacturers_id,
                            'products_quantity_order_min' => zen_db_prepare_input($_POST['products_quantity_order_min']),
                            'products_quantity_order_units' => zen_db_prepare_input($_POST['products_quantity_order_units']),
                            'products_priced_by_attribute' => zen_db_prepare_input($_POST['products_priced_by_attribute']),
                            'product_is_free' => zen_db_prepare_input((int)$_POST['product_is_free']),
                            'product_is_call' => zen_db_prepare_input((int)$_POST['product_is_call']),
                            'products_quantity_mixed' => zen_db_prepare_input($_POST['products_quantity_mixed']),
                            'product_is_always_free_shipping' => zen_db_prepare_input((int)$_POST['product_is_always_free_shipping']),
                            'products_qty_box_status' => zen_db_prepare_input($_POST['products_qty_box_status']),
                            'products_quantity_order_max' => zen_db_prepare_input($_POST['products_quantity_order_max']),
                            'products_sort_order' => (int)zen_db_prepare_input($_POST['products_sort_order']),
                            'products_discount_type' => zen_db_prepare_input($_POST['products_discount_type']),
                            'products_discount_type_from' => zen_db_prepare_input($_POST['products_discount_type_from']),
                            'products_price_sorter' => zen_db_prepare_input($_POST['products_price_sorter'])
                            );

    // when set to none remove from database
    // is out dated for browsers use radio only
      $sql_data_array['products_image'] = zen_db_prepare_input($_POST['products_image']);
      $new_image= 'true';

    if ($_POST['image_delete'] == 1) {
      $sql_data_array['products_image'] = '';
      $new_image= 'false';
    }

if ($_POST['image_delete'] == 1) {
      $sql_data_array['products_image'] = '';
      $new_image= 'false';
}

    if ($action == 'insert_product') {
      $insert_sql_data = array( 'products_date_added' => 'now()',
                                'master_categories_id' => (int)$current_category_id);

      $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

      zen_db_perform(TABLE_PRODUCTS, $sql_data_array);
      $products_id = zen_db_insert_id();

      // reset products_price_sorter for searches etc.
      zen_update_products_price_sorter($products_id);

      $db->Execute("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . "
                    (products_id, categories_id)
                    values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");

      ///////////////////////////////////////////////////////
      //// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////

          //AutoFacebook
          $app_id = "Your App_ID Here"; //given when you created app
          $app_secret = "Your App Secret Code Here"; //given when you created app
          $page_id = "Page ID Here"; //obtained from running facebook_authorization.php from your browser
          $page_token = "Page Token Here"; //long number obtained from facebook_authorization.php
          $store_name = "Your Store"; // store name i.e. "Mary's Car Shop", or "MikesCupcakes.com."
          $store_url = 'http://www.yourdomain.com'; //path to your store without the trailing "/"
          $cur = '$'; //change to your currency symbol($, €, £, ¥, etc.). Assumes symbol comes in front of numbers
          $new_message = "New Product Added";  // change to whatever or leave the same. i.e "New Cupcake!"

          // No Need to edit below here.
          $prod_image = $store_url . "/images/" . $_POST['products_image'];
          //webelity.com fixed number formating issues 11-4-2013 - 2.4   
	  //$price = $products_price;
	  $price = number_format($products_price, 2, '.', '');          
	  $prod_url = $store_url . '/index.php?main_page=product_info&cPath=' . $current_category_id . '&products_id=' . $products_id;
          $prod_name = $_POST['products_name'][$_SESSION['languages_id']];
          //webelity.com changed this line below to strip html tags from descriptions (Facebook does not support standard html input on descriptions via api calls)
          $prod_description = $_POST['products_description'][$_SESSION['languages_id']];

          //webelity.com changed this line below to strip html tags from descriptions (Facebook does not support standard html input on descriptions via api calls)
          $info_strip = preg_replace('/(<\/[^>]+?>)(<[^>\/][^>]*?>)/', '$1 $2', $prod_description);
          $description_stripped = strip_tags($info_strip);

          //webelity.com 1-15-2012 added check to insure length does not reach the 10,000 character limit on descriptions in facebook.
          $charset = 'UTF-8';
          $no_description = 0;
          $length = 9996;
          if(mb_strlen($description_stripped, $charset) > $length) {
            $facebook_description = mb_substr($description_stripped, 0, $length, $charset) . '...';
          }
          elseif(mb_strlen($description_stripped, $charset) == $no_description)
          {
            $facebook_description = "No description provided for this product.";
          }
          else
          {
              $facebook_description = $description_stripped;
          }

          include_once 'facebook/facebook.php';

          $facebook = new Facebook(array(
              'appId'  => $app_id,
              'secret' => $app_secret,
              'cookie' => true, )
          );
          // webelity.com modfied currancy and price information and added facebook_description to lower array
          $attachment = array(
              'access_token'      =>  $page_token,
              'message'           =>  $new_message . " - " . $prod_name,
              'name'              =>  $prod_name,
              'link'              =>  $prod_url,
              'caption'           =>  'Price: ' . $cur . $price,
              'description'       =>  $facebook_description,
              'picture'           =>  $prod_image
          );
          try {
            $status = $facebook->api($page_id.'/feed', 'post', $attachment);
            $messageStack->add_session('Facebook was successfully updated!', 'success');
          }
          catch (FacebookApiException $fbe){
            $fberror = $fbe->result['error']['message'];
            $messageStack->add_session('Facebook Error: '.$fberror, 'error');
          }

      ////    *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
      ///////////////////////////////////////////////////////
    } elseif ($action == 'update_product') {
      $update_sql_data = array( 'products_last_modified' => 'now()',
                                'master_categories_id' => ($_POST['master_category'] > 0 ? zen_db_prepare_input($_POST['master_category']) : zen_db_prepare_input($_POST['master_categories_id'])));

      $sql_data_array = array_merge($sql_data_array, $update_sql_data);

      zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

      // reset products_price_sorter for searches etc.
      zen_update_products_price_sorter((int)$products_id);

      ///////////////////////////////////////////////////////
      //// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////

      //AutoFacebook  Video instructions can be found on YouTube at: youtu.be/IfW42McTKyE
          $app_id = "Your App_ID Here"; //given when you created app
          $app_secret = "Your App Secret Code Here"; //given when you created app
          $page_id = "Page ID Here"; //obtained from running facebook_authorization.php from your browser
          $page_token = "Page Token Here"; //long number obtained from facebook_authorization.php
          $store_name = "Your Store"; // store name i.e. "Mary's Car Shop", or "MikesCupcakes.com."
          $store_url = 'http://www.yourdomain.com'; //path to your store without the trailing "/"
          $cur = '$'; //change to your currency symbol($, €, £, ¥, etc.). Assumes symbol comes in front of numbers
          $new_message = "Product Updated";  // change to whatever or leave the same. i.e "New Cupcake!"

          $prod_image = $store_url . "/images/" . $_POST['products_image'];
          //webelity.com fixed number formating issues 11-4-2013 - 2.4  
	  //$price = $products_price;
	  $price = number_format($products_price, 2, '.', '');    
          $prod_url = $store_url . '/index.php?main_page=product_info&cPath=' . $current_category_id . '&products_id=' . $products_id;
          $prod_name = $_POST['products_name'][$_SESSION['languages_id']];
          $prod_description = $_POST['products_description'][$_SESSION['languages_id']];

          //webelity.com changed this line below to strip html tags from descriptions (Facebook does not support standard html input on descriptions via api calls)
          $info_strip = preg_replace('/(<\/[^>]+?>)(<[^>\/][^>]*?>)/', '$1 $2', $prod_description);
          $description_stripped = strip_tags($info_strip);

          //webelity.com 1-15-2012 added check to insure length does not reach the 10,000 character limit on descriptions in facebook.
          $charset = 'UTF-8';
          $no_description = 0;
          $length = 9996;
          if(mb_strlen($description_stripped, $charset) > $length) {
            $facebook_description = mb_substr($description_stripped, 0, $length, $charset) . '...';
          }
          elseif(mb_strlen($description_stripped, $charset) == $no_description)
          {
            $facebook_description = "No description provided for this product.";
          }
          else
          {
              $facebook_description = $description_stripped;
          }

          include_once 'facebook/facebook.php';

          $facebook = new Facebook(array(
              'appId'  => $app_id,
              'secret' => $app_secret,
              'cookie' => true, )
          );
          // webelity.com modfied currancy and price information and added facebook_description to lower array
          $attachment = array(
              'access_token'      =>  $page_token,
              'message'           =>  $new_message . " - " . $prod_name,
              'name'              =>  $prod_name,
              'link'              =>  $prod_url,
              'caption'           =>  'Price: ' . $cur . $price,
              'description'       =>  $facebook_description,
              'picture'           =>  $prod_image
          );
          try {
            $status = $facebook->api($page_id.'/feed', 'post', $attachment);
            $messageStack->add_session('Facebook was successfully updated!', 'success');
          }
          catch (FacebookApiException $fbe){
            $fberror = $fbe->result['error']['message'];
            $messageStack->add_session('Facebook Error: '.$fberror, 'error');
          }

      ////    *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
      ///////////////////////////////////////////////////////
    }

    $languages = zen_get_languages();
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
      $language_id = $languages[$i]['id'];

      $sql_data_array = array('products_name' => zen_db_prepare_input($_POST['products_name'][$language_id]),
                              'products_description' => zen_db_prepare_input($_POST['products_description'][$language_id]),
                              'products_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));

      if ($action == 'insert_product') {
        $insert_sql_data = array('products_id' => (int)$products_id,
                                 'language_id' => (int)$language_id);

        $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

        zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
      } elseif ($action == 'update_product') {
        zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
      }
    }

    // add meta tags
    $languages = zen_get_languages();
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
      $language_id = $languages[$i]['id'];

      $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
                              'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
                              'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));

      if ($action == 'insert_product_meta_tags') {

        $insert_sql_data = array('products_id' => (int)$products_id,
                                 'language_id' => (int)$language_id);

        $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

        zen_db_perform(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array);
      } elseif ($action == 'update_product_meta_tags') {
        zen_db_perform(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
      }
    }


    // future image handler code
    define('IMAGE_MANAGER_HANDLER', 0);
    define('DIR_IMAGEMAGICK', '');
    if ($new_image == 'true' and IMAGE_MANAGER_HANDLER >= 1) {
      $src= DIR_FS_CATALOG . DIR_WS_IMAGES . zen_get_products_image((int)$products_id);
      $filename_small= $src;
      preg_match("/.*\/(.*)\.(\w*)$/", $src, $fname);
      list($oiwidth, $oiheight, $oitype) = getimagesize($src);

      $small_width= SMALL_IMAGE_WIDTH;
      $small_height= SMALL_IMAGE_HEIGHT;
      $medium_width= MEDIUM_IMAGE_WIDTH;
      $medium_height= MEDIUM_IMAGE_HEIGHT;
      $large_width= LARGE_IMAGE_WIDTH;
      $large_height= LARGE_IMAGE_HEIGHT;

      $k = max($oiheight / $small_height, $oiwidth / $small_width); //use smallest size
      $small_width = round($oiwidth / $k);
      $small_height = round($oiheight / $k);

      $k = max($oiheight / $medium_height, $oiwidth / $medium_width); //use smallest size
      $medium_width = round($oiwidth / $k);
      $medium_height = round($oiheight / $k);

      $large_width= $oiwidth;
      $large_height= $oiheight;

      $products_image = zen_get_products_image((int)$products_id);
      $products_image_extension = substr($products_image, strrpos($products_image, '.'));
      $products_image_base = preg_replace('/'.$products_image_extension.'/', '', $products_image);

      $filename_medium = DIR_FS_CATALOG . DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . '.' . $fname[2];
      $filename_large = DIR_FS_CATALOG . DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . '.' . $fname[2];

      // ImageMagick
      if (IMAGE_MANAGER_HANDLER == '1') {
        copy($src, $filename_large);
        copy($src, $filename_medium);
        exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $large_width . " " . $filename_large);
        exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $medium_width . " " . $filename_medium);
        exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $small_width . " " . $filename_small);
      }
    }

    zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '') ));
  } else {
    $messageStack->add_session(ERROR_NO_DATA_TO_SAVE, 'error');
    zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '') ));
  }
23 Jan 2014, 1:58 AM
#631
laurelsstitchery avatar

laurelsstitchery

Zen Follower

Join Date:
Jun 2010
Posts:
145
Plugin Contributions:
0

Re: AutoFacebook [Support]

[22-Jan-2014 18:23:32] PHP Warning: Cannot modify header information - headers already sent by (output started at /home1/public_html/newadmin/includes/modules/update_product.php:1) in /home1/public_html/newadmin/includes/functions/general.php on line 21

I'm having the exact same problem as above. I'm installing this on a fresh install of ZC 1.5.1, so I just uploaded the update_product.php file with no changes. That didn't work, so I merged the two as specified above and that didn't work either. The product gets posted to FB, but on ZC, it loads up a blank page instead of going back to the categories page. Help anyone? :)

1 Feb 2014, 4:05 PM
#632
ducati87 avatar

ducati87

New Zenner

Join Date:
Dec 2010
Posts:
28
Plugin Contributions:
0

Re: AutoFacebook [Support]

Hello guys, I have a small problem with the plugin.
I'm on zencart 1.3.9h and I installed the plugin using the video tutorial, but I have a problem with the automatic posting on my facebook page.
The posting doesn't come with my facebook page name but with my real name!
This is an example:

Attachment 13732

How can I fix it? Thanks!

4 Feb 2014, 6:31 PM
#633
little_red_crane avatar

little_red_crane

New Zenner

Join Date:
Mar 2009
Posts:
20
Plugin Contributions:
0

Re: AutoFacebook [Support]

zch0071:

Hi,
I need help.
I have used autofacebook plug-in to upload the products information to facebook, but the pictures on facebook are completely inconformity from the website. The facebook has resized the pictures a lot and the pictures looks very twisted.
facebook info:
Attachment 13350
Product info:
Attachment 13351

how to fix?

I Am Having The Same Issue How Can I Solve This!!!!! The Pic Of My Product In The Post On Facebook Is WAY TO BIG!!!

25 Feb 2014, 6:19 AM
#634
kentuckygurl avatar

kentuckygurl

New Zenner

Join Date:
Dec 2010
Posts:
10
Plugin Contributions:
0

Re: AutoFacebook [Support]

I was wondering if the answer about posting to the page instead of the personal wall has been answered? I tried going back through the thread but was a little confused. I am having the same issue and would love to get it straigtened out. Thanks!

1 Mar 2014, 9:01 AM
#635
jailop492 avatar

jailop492

New Zenner

Join Date:
Feb 2014
Location:
United States
Posts:
8
Plugin Contributions:
0

Re: AutoFacebook [Support]

Having same problem getting blank page and same errors as everybody else.
Whenever I add a new Product or Update a product it takes me to BLANK PAGE.

[01-Mar-2014 01:43:38] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/content/54/6674154/html/crochets/adminurrhtcqq/includes/modules/update_product.php:1) in /home/content/54/6674154/html/crochets/adminurrhtcqq/includes/functions/general.php on line 21

1 Mar 2014, 3:47 PM
#636
jailop492 avatar

jailop492

New Zenner

Join Date:
Feb 2014
Location:
United States
Posts:
8
Plugin Contributions:
0

Re: AutoFacebook [Support]

In Case anybody having same error try replacing entire update_product.php with this code:
This is currently working for me.
But remember you put your FaceBook Info

<?php
/**
 * @package admin
 * @copyright Copyright 2003-2011 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: update_product.php 18695 2011-05-04 05:24:19Z drbyte $
 */
  if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
  }
  if (isset($_GET['pID'])) $products_id = zen_db_prepare_input($_GET['pID']);
  if (isset($_POST['edit_x']) || isset($_POST['edit_y'])) {
    $action = 'new_product';
  } elseif ($_POST['products_model'] . $_POST['products_url'] . $_POST['products_name'] . $_POST['products_description'] != '') {
    $products_date_available = zen_db_prepare_input($_POST['products_date_available']);

    $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

    // Data-cleaning to prevent MySQL5 data-type mismatch errors:
    $tmp_value = zen_db_prepare_input($_POST['products_quantity']);
    $products_quantity = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['products_price']);
    $products_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['products_weight']);
    $products_weight = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
    $tmp_value = zen_db_prepare_input($_POST['manufacturers_id']);
    $manufacturers_id = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;

    $sql_data_array = array('products_quantity' => $products_quantity,
                            'products_type' => zen_db_prepare_input($_GET['product_type']),
                            'products_model' => zen_db_prepare_input($_POST['products_model']),
                            'products_price' => $products_price,
                            'products_date_available' => $products_date_available,
                            'products_weight' => $products_weight,
                            'products_status' => zen_db_prepare_input((int)$_POST['products_status']),
                            'products_virtual' => zen_db_prepare_input((int)$_POST['products_virtual']),
                            'products_tax_class_id' => zen_db_prepare_input((int)$_POST['products_tax_class_id']),
                            'manufacturers_id' => $manufacturers_id,
                            'products_quantity_order_min' => zen_db_prepare_input($_POST['products_quantity_order_min']),
                            'products_quantity_order_units' => zen_db_prepare_input($_POST['products_quantity_order_units']),
                            'products_priced_by_attribute' => zen_db_prepare_input($_POST['products_priced_by_attribute']),
                            'product_is_free' => zen_db_prepare_input((int)$_POST['product_is_free']),
                            'product_is_call' => zen_db_prepare_input((int)$_POST['product_is_call']),
                            'products_quantity_mixed' => zen_db_prepare_input($_POST['products_quantity_mixed']),
                            'product_is_always_free_shipping' => zen_db_prepare_input((int)$_POST['product_is_always_free_shipping']),
                            'products_qty_box_status' => zen_db_prepare_input($_POST['products_qty_box_status']),
                            'products_quantity_order_max' => zen_db_prepare_input($_POST['products_quantity_order_max']),
                            'products_sort_order' => (int)zen_db_prepare_input($_POST['products_sort_order']),
                            'products_discount_type' => zen_db_prepare_input($_POST['products_discount_type']),
                            'products_discount_type_from' => zen_db_prepare_input($_POST['products_discount_type_from']),
                            'products_price_sorter' => zen_db_prepare_input($_POST['products_price_sorter'])
                            );

    // when set to none remove from database
    // is out dated for browsers use radio only
      $sql_data_array['products_image'] = zen_db_prepare_input($_POST['products_image']);
      $new_image= 'true';

    if ($_POST['image_delete'] == 1) {
      $sql_data_array['products_image'] = '';
      $new_image= 'false';
    }

if ($_POST['image_delete'] == 1) {
      $sql_data_array['products_image'] = '';
      $new_image= 'false';
}

    if ($action == 'insert_product') {
      $insert_sql_data = array( 'products_date_added' => 'now()',
                                'master_categories_id' => (int)$current_category_id);

      $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

      zen_db_perform(TABLE_PRODUCTS, $sql_data_array);
      $products_id = zen_db_insert_id();

      // reset products_price_sorter for searches etc.
      zen_update_products_price_sorter($products_id);

      $db->Execute("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . "
                    (products_id, categories_id)
                    values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");

      ///////////////////////////////////////////////////////
      //// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////
          //AutoFacebook
          $app_id = "Your App_ID Here"; //given when you created app
          $app_secret = "Your App Secret Code Here"; //given when you created app
          $page_id = "Page ID Here"; //obtained from running facebook_authorization.php from your browser
          $page_token = "Page Token Here"; //long number obtained from facebook_authorization.php
          $store_name = "Your Store"; // store name i.e. "Mary's Car Shop", or "MikesCupcakes.com."
          $store_url = 'http://www.yourdomain.com'; //path to your store without the trailing "/"
          $cur = '$'; //change to your currency symbol($, €, £, ¥, etc.). Assumes symbol comes in front of numbers
          $new_message = "New Product Added";  // change to whatever or leave the same. i.e "New Cupcake!"

          // No Need to edit below here.
          $prod_image = $store_url . "/images/" . $_POST['products_image'];
          //webelity.com fixed number formating issues 11-4-2013 - 2.4   
	  //$price = $products_price;
	  $price = number_format($products_price, 2, '.', '');          
	  $prod_url = $store_url . '/index.php?main_page=product_info&cPath=' . $current_category_id . '&products_id=' . $products_id;
          $prod_name = $_POST['products_name'][$_SESSION['languages_id']];
          //webelity.com changed this line below to strip html tags from descriptions (Facebook does not support standard html input on descriptions via api calls)
          $prod_description = $_POST['products_description'][$_SESSION['languages_id']];

          //webelity.com changed this line below to strip html tags from descriptions (Facebook does not support standard html input on descriptions via api calls)
          $info_strip = preg_replace('/(<\/[^>]+?>)(<[^>\/][^>]*?>)/', '$1 $2', $prod_description);
          $description_stripped = strip_tags($info_strip);

          //webelity.com 1-15-2012 added check to insure length does not reach the 10,000 character limit on descriptions in facebook.
          $charset = 'UTF-8';
          $no_description = 0;
          $length = 9996;
          if(mb_strlen($description_stripped, $charset) > $length) {
            $facebook_description = mb_substr($description_stripped, 0, $length, $charset) . '...';
          }
          elseif(mb_strlen($description_stripped, $charset) == $no_description)
          {
            $facebook_description = "No description provided for this product.";
          }
          else
          {
              $facebook_description = $description_stripped;
          }

          include_once 'facebook/facebook.php';

          $facebook = new Facebook(array(
              'appId'  => $app_id,
              'secret' => $app_secret,
              'cookie' => true, )
          );
          // webelity.com modfied currancy and price information and added facebook_description to lower array
          $attachment = array(
              'access_token'      =>  $page_token,
              'message'           =>  $new_message . " - " . $prod_name,
              'name'              =>  $prod_name,
              'link'              =>  $prod_url,
              'caption'           =>  'Price: ' . $cur . $price,
              'description'       =>  $facebook_description,
              'picture'           =>  $prod_image
          );
          try {
            $status = $facebook->api($page_id.'/feed', 'post', $attachment);
            $messageStack->add_session('Facebook was successfully updated!', 'success');
          }
          catch (FacebookApiException $fbe){
            $fberror = $fbe->result['error']['message'];
            $messageStack->add_session('Facebook Error: '.$fberror, 'error');
          }


      ////    *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
      ///////////////////////////////////////////////////////
    } elseif ($action == 'update_product') {
      $update_sql_data = array( 'products_last_modified' => 'now()',
                                'master_categories_id' => ($_POST['master_category'] > 0 ? zen_db_prepare_input($_POST['master_category']) : zen_db_prepare_input($_POST['master_categories_id'])));

      $sql_data_array = array_merge($sql_data_array, $update_sql_data);

      zen_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

      // reset products_price_sorter for searches etc.
      zen_update_products_price_sorter((int)$products_id);

      ///////////////////////////////////////////////////////
      //// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
          //AutoFacebook
          $app_id = "Your App_ID Here"; //given when you created app
          $app_secret = "Your App Secret Code Here"; //given when you created app
          $page_id = "Page ID Here"; //obtained from running facebook_authorization.php from your browser
          $page_token = "Page Token Here"; //long number obtained from facebook_authorization.php
          $store_name = "Your Store"; // store name i.e. "Mary's Car Shop", or "MikesCupcakes.com."
          $store_url = 'http://www.yourdomain.com'; //path to your store without the trailing "/"
          $cur = '$'; //change to your currency symbol($, €, £, ¥, etc.). Assumes symbol comes in front of numbers
          $new_message = "New Product Added";  // change to whatever or leave the same. i.e "New Cupcake!"

          // No Need to edit below here.
          $prod_image = $store_url . "/images/" . $_POST['products_image'];
          //webelity.com fixed number formating issues 11-4-2013 - 2.4   
	  //$price = $products_price;
	  $price = number_format($products_price, 2, '.', '');          
	  $prod_url = $store_url . '/index.php?main_page=product_info&cPath=' . $current_category_id . '&products_id=' . $products_id;
          $prod_name = $_POST['products_name'][$_SESSION['languages_id']];
          //webelity.com changed this line below to strip html tags from descriptions (Facebook does not support standard html input on descriptions via api calls)
          $prod_description = $_POST['products_description'][$_SESSION['languages_id']];

          //webelity.com changed this line below to strip html tags from descriptions (Facebook does not support standard html input on descriptions via api calls)
          $info_strip = preg_replace('/(<\/[^>]+?>)(<[^>\/][^>]*?>)/', '$1 $2', $prod_description);
          $description_stripped = strip_tags($info_strip);

          //webelity.com 1-15-2012 added check to insure length does not reach the 10,000 character limit on descriptions in facebook.
          $charset = 'UTF-8';
          $no_description = 0;
          $length = 9996;
          if(mb_strlen($description_stripped, $charset) > $length) {
            $facebook_description = mb_substr($description_stripped, 0, $length, $charset) . '...';
          }
          elseif(mb_strlen($description_stripped, $charset) == $no_description)
          {
            $facebook_description = "No description provided for this product.";
          }
          else
          {
              $facebook_description = $description_stripped;
          }

          include_once 'facebook/facebook.php';

          $facebook = new Facebook(array(
              'appId'  => $app_id,
              'secret' => $app_secret,
              'cookie' => true, )
          );
          // webelity.com modfied currancy and price information and added facebook_description to lower array
          $attachment = array(
              'access_token'      =>  $page_token,
              'message'           =>  $new_message . " - " . $prod_name,
              'name'              =>  $prod_name,
              'link'              =>  $prod_url,
              'caption'           =>  'Price: ' . $cur . $price,
              'description'       =>  $facebook_description,
              'picture'           =>  $prod_image
          );
          try {
            $status = $facebook->api($page_id.'/feed', 'post', $attachment);
            $messageStack->add_session('Facebook was successfully updated!', 'success');
          }
          catch (FacebookApiException $fbe){
            $fberror = $fbe->result['error']['message'];
            $messageStack->add_session('Facebook Error: '.$fberror, 'error');
          }


      ////    *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
      ///////////////////////////////////////////////////////
    }

    $languages = zen_get_languages();
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
      $language_id = $languages[$i]['id'];

      $sql_data_array = array('products_name' => zen_db_prepare_input($_POST['products_name'][$language_id]),
                              'products_description' => zen_db_prepare_input($_POST['products_description'][$language_id]),
                              'products_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));

      if ($action == 'insert_product') {
        $insert_sql_data = array('products_id' => (int)$products_id,
                                 'language_id' => (int)$language_id);

        $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

        zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
      } elseif ($action == 'update_product') {
        zen_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
      }
    }

    // add meta tags
    $languages = zen_get_languages();
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
      $language_id = $languages[$i]['id'];

      $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
                              'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
                              'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));

      if ($action == 'insert_product_meta_tags') {

        $insert_sql_data = array('products_id' => (int)$products_id,
                                 'language_id' => (int)$language_id);

        $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

        zen_db_perform(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array);
      } elseif ($action == 'update_product_meta_tags') {
        zen_db_perform(TABLE_META_TAGS_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");
      }
    }


    // future image handler code
    define('IMAGE_MANAGER_HANDLER', 0);
    define('DIR_IMAGEMAGICK', '');
    if ($new_image == 'true' and IMAGE_MANAGER_HANDLER >= 1) {
      $src= DIR_FS_CATALOG . DIR_WS_IMAGES . zen_get_products_image((int)$products_id);
      $filename_small= $src;
      preg_match("/.*\/(.*)\.(\w*)$/", $src, $fname);
      list($oiwidth, $oiheight, $oitype) = getimagesize($src);

      $small_width= SMALL_IMAGE_WIDTH;
      $small_height= SMALL_IMAGE_HEIGHT;
      $medium_width= MEDIUM_IMAGE_WIDTH;
      $medium_height= MEDIUM_IMAGE_HEIGHT;
      $large_width= LARGE_IMAGE_WIDTH;
      $large_height= LARGE_IMAGE_HEIGHT;

      $k = max($oiheight / $small_height, $oiwidth / $small_width); //use smallest size
      $small_width = round($oiwidth / $k);
      $small_height = round($oiheight / $k);

      $k = max($oiheight / $medium_height, $oiwidth / $medium_width); //use smallest size
      $medium_width = round($oiwidth / $k);
      $medium_height = round($oiheight / $k);

      $large_width= $oiwidth;
      $large_height= $oiheight;

      $products_image = zen_get_products_image((int)$products_id);
      $products_image_extension = substr($products_image, strrpos($products_image, '.'));
      $products_image_base = preg_replace('/'.$products_image_extension.'/', '', $products_image);

      $filename_medium = DIR_FS_CATALOG . DIR_WS_IMAGES . 'medium/' . $products_image_base . IMAGE_SUFFIX_MEDIUM . '.' . $fname[2];
      $filename_large = DIR_FS_CATALOG . DIR_WS_IMAGES . 'large/' . $products_image_base . IMAGE_SUFFIX_LARGE . '.' . $fname[2];

      // ImageMagick
      if (IMAGE_MANAGER_HANDLER == '1') {
        copy($src, $filename_large);
        copy($src, $filename_medium);
        exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $large_width . " " . $filename_large);
        exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $medium_width . " " . $filename_medium);
        exec(DIR_IMAGEMAGICK . "mogrify -geometry " . $small_width . " " . $filename_small);
      }
    }

    zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '') ));
  } else {
    $messageStack->add_session(ERROR_NO_DATA_TO_SAVE, 'error');
    zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_POST['search']) ? '&search=' . $_POST['search'] : '') ));
  }
9 Mar 2014, 2:59 PM
#637
andilyn avatar

andilyn

New Zenner

Join Date:
Nov 2009
Location:
Florida
Posts:
19
Plugin Contributions:
0

Re: AutoFacebook [Support]

Will there be updated instructions for setting up the App on Facebook? Apparently they've made some major changes with several steps that aren't in the current video.

17 Apr 2014, 4:11 PM
#638
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Re: AutoFacebook [Support]

andilyn:

Will there be updated instructions for setting up the App on Facebook? Apparently they've made some major changes with several steps that aren't in the current video.

I would like to know this too. The Facebook screens and options shown in the video do not seem to exist anymore.

Danielle

19 May 2014, 6:57 PM
#639
elvisstuff avatar

elvisstuff

New Zenner

Join Date:
Jan 2010
Posts:
33
Plugin Contributions:
0

Re: AutoFacebook [Support]

Danielle:

I would like to know this too. The Facebook screens and options shown in the video do not seem to exist anymore.
I would like updated instructions too (please). It's two months since the first request. Is this support forum no longer supported?

7 Jul 2014, 1:18 PM
#640
rizla avatar

rizla

Zen Follower

Join Date:
Sep 2010
Posts:
449
Plugin Contributions:
0

Re: AutoFacebook [Support]

I know there is no support for this mod but I'm hoping someone can point me in the right direction:

Basically, the product image is too large on my facebook page. Any fix?