Page 64 of 70 FirstFirst ... 14546263646566 ... LastLast
Results 631 to 640 of 695
  1. #631
    Join Date
    Nov 2007
    Posts
    433
    Plugin Contributions
    1

    Default 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 ..

  2. #632
    Join Date
    Aug 2013
    Location
    Brisbane
    Posts
    25
    Plugin Contributions
    0

    Default 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

  3. #633
    Join Date
    Apr 2012
    Location
    Los Angeles, CA
    Posts
    185
    Plugin Contributions
    2

    Default Re: AutoFacebook [Support]

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

  4. #634
    Join Date
    Apr 2012
    Location
    Los Angeles, CA
    Posts
    185
    Plugin Contributions
    2

    Default Re: AutoFacebook [Support]

    Quote Originally Posted by alhakeem2001 View Post
    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
    Code:
    <?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'] : '') ));
      }

  5. #635
    Join Date
    Jun 2010
    Posts
    145
    Plugin Contributions
    0

    Default 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? :)

  6. #636
    Join Date
    Dec 2010
    Posts
    28
    Plugin Contributions
    0

    Default 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:

    Name:  screen1.jpg
Views: 249
Size:  15.3 KB

    How can I fix it? Thanks!

  7. #637

    Default Re: AutoFacebook [Support]

    Quote Originally Posted by zch0071 View Post
    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!!!
    Last edited by Little Red Crane; 4 Feb 2014 at 07:33 PM.

  8. #638
    Join Date
    Dec 2010
    Posts
    10
    Plugin Contributions
    0

    Default 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!

  9. #639
    Join Date
    Feb 2014
    Location
    United States
    Posts
    8
    Plugin Contributions
    1

    Default 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

  10. #640
    Join Date
    Feb 2014
    Location
    United States
    Posts
    8
    Plugin Contributions
    1

    Default 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 Code:
    <?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) ? $tmp_value;
        
    $tmp_value zen_db_prepare_input($_POST['products_price']);
        
    $products_price = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? $tmp_value;
        
    $tmp_value zen_db_prepare_input($_POST['products_weight']);
        
    $products_weight = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? $tmp_value;
        
    $tmp_value zen_db_prepare_input($_POST['manufacturers_id']);
        
    $manufacturers_id = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 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_price2'.''');          
          
    $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_stripped0$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'] > 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_price2'.''');          
          
    $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_stripped0$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) {
          
    $srcDIR_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_widthSMALL_IMAGE_WIDTH;
          
    $small_heightSMALL_IMAGE_HEIGHT;
          
    $medium_widthMEDIUM_IMAGE_WIDTH;
          
    $medium_heightMEDIUM_IMAGE_HEIGHT;
          
    $large_widthLARGE_IMAGE_WIDTH;
          
    $large_heightLARGE_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_imagestrrpos($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'] : '') ));
      }

 

 
Page 64 of 70 FirstFirst ... 14546263646566 ... LastLast

Similar Threads

  1. v151 autofacebook help
    By sean g in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 27 Nov 2014, 08:52 PM
  2. AutoFacebook and Canada Post Modules
    By DJLQD in forum General Questions
    Replies: 0
    Last Post: 27 Feb 2013, 02:32 PM
  3. v139h Help please with Autofacebook - Support thread is no longer supported
    By shags38 in forum General Questions
    Replies: 0
    Last Post: 18 Jul 2012, 01:49 PM
  4. Problems with AutoFacebook
    By amanda099 in forum All Other Contributions/Addons
    Replies: 1
    Last Post: 31 Aug 2010, 10:12 AM
  5. AutoFacebook OG 1.3.9 addon problems
    By eOstrE in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 7 Jul 2010, 09:44 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