Re: AutoFacebook [Support]
Fair enough point. As you say the loss is minimal plus Facebook are constantly changing the way their API works. There's a lot of third party apps that will work fine one day, then FB do a dance and everybody has to suddenly change from a waltz to a polka!
The current plug in works fine and I can live with it.
Re: AutoFacebook [Support]
After ftp the facebook_authorization.php to my site, I clicked to http://myshop.com/facebook_authorization.php
The page asked some questions about let facebook XXX manage this page (something like this!), and I clicked "ok" for all questions. Then it showed up the following error:
Code:
Status: array (
0 => 'access_token',
1 => 'CAAFIAGUjZA2kBALPR78YvPOvf0T7gtQ10dcl0ZAdUuyVoE4scOOynhHtie10rW37FWnTReuMsJZAZAbr7yHZBG9ViZAXhsxpXR1OK1TvB7tOOIu3bK78Xb9ANqWzY3eNLbgvVKAdwZA7JSNZBz7tIZAuVbXZCU9CiiAGAZD&expires',
2 => '5183043',
)
Array
(
[data] => Array
(
)
)
array (
'data' =>
array (
),
)
after a while, I refreshed the page, it showed anothe page with:
Code:
Status: array (
0 => '{"error":{"message":"This authorization code has expired.","type":"OAuthException","code":100}}',
)
Below showed the error log:
Code:
23:05:45] PHP Fatal error: Uncaught OAuthException: An active access token must be used to query information about the current user.
thrown in /public_html/facebook_authorization.php on line 533
I installed autoFacebook-v2.3, with 1.5.1 zencart and PHP Version: 5.2.17 (Zend: 2.2.0)
How can I fix it. Thanks very much!
Re: AutoFacebook [Support]
Problems solved!
I missed to open a fan page before visiting http://xxx/facebook_authorization.php
It is a Great module! Save much time to manage facebook fan page!
If facebook fan can show discount price is perfect! Now it is the original price.
Re: AutoFacebook [Support]
Hi Delia,
Real pity this mod isn't supported - maybe one day another coder familiar with Zen-Cart will pick up the ball and run with it :smile:
Do you have any idea how to limit the auto upload to Facebook so that it only applies to certain conditions, e.g. new item or item placed on sale - currently it uploads EVERY TIME there is a minor adjustment to the product description - this can mean 3 or more times for the same product if you decide to modify what you have submitted which I do quite often - it is a real pain when you are making description changes or additions to hundreds of existing items in a batch - slows things down considerably also whilst trying to reach Facebook and I'm sure my Facebook followers do not want to receive hundreds of alerts in a short period of time (they would soon become ex followers).
Any advice is welcomed.
cheers,
Mike
I 'chased' Jamie Life via his website/blog for ages before I got any responses from him many moons ago
Re: AutoFacebook [Support]
Quote:
Originally Posted by
shags38
Do you have any idea how to limit the auto upload to Facebook so that it only applies to certain conditions, e.g. new item or item placed on sale - currently it uploads EVERY TIME there is a minor adjustment to the product description - this can mean 3 or more times for the same product if you decide to modify what you have submitted which I do quite often - it is a real pain when you are making description changes or additions to hundreds of existing items in a batch - slows things down considerably also whilst trying to reach Facebook and I'm sure my Facebook followers do not want to receive hundreds of alerts in a short period of time (they would soon become ex followers).
I did make this modification on my site so on the product page in the admin there is a radio button to update fb or not because I was running into this very problem. There are several core files to edit and a db modification or two but it allows you to dictate when fb is updated. I was using one of the earlier versions of this mod (not the lite version), I haven't been following this so I don't know where it is code-wise compared to what I am using. But I think my changes might be neutral in relation to this module's code but I need to double check since it's been quite a while since I wrote it. I will have a look at my code and notes and post it here for anyone that is interested.
Re: AutoFacebook [Support]
Quote:
Originally Posted by
lankeeyankee
I did make this modification on my site so on the product page in the admin there is a radio button to update fb or not because I was running into this very problem. There are several core files to edit and a db modification or two but it allows you to dictate when fb is updated. I was using one of the earlier versions of this mod (not the lite version), I haven't been following this so I don't know where it is code-wise compared to what I am using. But I think my changes might be neutral in relation to this module's code but I need to double check since it's been quite a while since I wrote it. I will have a look at my code and notes and post it here for anyone that is interested.
Many thanks Lanky!! I look forward to you posting the code.
cheers,
Mike
Re: AutoFacebook [Support]
OK, here are the changes I made. I recommend testing them on a test site since I was using the earlier version of auto facebook (version 2.0) and there might be some compatibility issues with a newer version of the module. You will need to add an extra field to the db products table so you should back up your db before doing this. Also, this is on 1.3.9h so there may or may not be differences in where to place the new code in 1.5.x but it should still work.
Insert this using phpmyadmin or in the sql patch in the admin. The db field, you might need to change the table name if you add prefixes so table products might become table zen_products or whatever:
Code:
ALTER TABLE `products` ADD `facebook_add` tinyint(1) NOT NULL DEFAULT '0';
In admin/includes/modules/product/collect_info.php around line 41 look for this line
PHP Code:
'master_categories_id' => ''
and change it to
PHP Code:
'master_categories_id' => '',
'facebook_add' => ''
around line 59 look for
PHP Code:
p.master_categories_id
and change to
PHP Code:
p.master_categories_id, p.facebook_add
around line 150 look for this
PHP Code:
// Products can be purchased with mixed attributes retail
if (!isset($pInfo->products_quantity_mixed)) $pInfo->products_quantity_mixed = '0';
switch ($pInfo->products_quantity_mixed) {
case '0': $in_products_quantity_mixed = false; $out_products_quantity_mixed = true; break;
case '1': $in_products_quantity_mixed = true; $out_products_quantity_mixed = false; break;
default: $in_products_quantity_mixed = true; $out_products_quantity_mixed = false;
}
and after it add this
PHP Code:
if (!isset($pInfo->facebook_add)) $pInfo->facebook_add = '0';
switch ($pInfo->facebook_add) {
case '0': $is_facebook_add_enabled = false; $not_facebook_add_enabled = true; break;
case '1': $is_facebook_add_enabled = true; $not_facebook_add_enabled = false; break;
default: $is_facebook_add_enabled = false; $not_facebook_add_enabled = true;
}
around line 412 look for this
PHP Code:
<tr>
<td class="main"><?php echo TEXT_PRODUCT_IS_FREE; ?></td>
and right above it add this
PHP Code:
<tr>
<td class="main">Add/update Facebook?</td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_radio_field('facebook_add', '1', $is_facebook_add_enabled) . ' Yes ' . zen_draw_radio_field('facebook_add', '0', $not_facebook_add_enabled) . ' No ' . ($pInfo->facebook_add == 1 ? 'Add to facebook?' : ''); ?></td>
</tr>
You can add the above line of code anywhere in that table that suits your preference, I just found it convenient to add it there.
In admin/includes/modules/product/preview_info.php look around line 26 for
PHP Code:
p.products_sort_order
and change to
PHP Code:
p.products_sort_order, p.facebook_add
around line 74 look for
PHP Code:
echo zen_image(DIR_WS_CATALOG_IMAGES . $products_image_name, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . $pInfo->products_description;
}
?>
</td>
</tr>
and change it to
PHP Code:
echo zen_image(DIR_WS_CATALOG_IMAGES . $products_image_name, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . $pInfo->products_description;
}
?>
<!--BO FACEBOOK-->
</tr><tr>
<td><hr></td>
</tr><tr>
<td class="smallText">
<?php
$facebook_add = $_POST['facebook_add'];
if ($facebook_add == 1) {
echo "Facebook Will be Updated.";
} else {
echo "Facebook Will NOT be Updated.";
}
?>
</td> </tr>
<tr>
<!--EO FACEBOOK-->
</td>
</tr>
This gives you a message on the preview page of whether or not facebook will be updated.
In admin/includes/modules/update_product.php around line 9 look for
PHP Code:
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
and after add this
PHP Code:
$facebook_add = $_POST['facebook_add'];
around line 52 look for
PHP Code:
'products_price_sorter' => zen_db_prepare_input($_POST['products_price_sorter'])
and change it to
PHP Code:
'products_price_sorter' => zen_db_prepare_input($_POST['products_price_sorter']),
'facebook_add' => zen_db_prepare_input($_POST['facebook_add'])
around line 87 look for
PHP Code:
//// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////
and below it add
PHP Code:
if ($facebook_add == 1) {
Now, this is where one of the main auto facebook code is in my site, I do not know if this is still the case with other/newer versions of this module. If the auto facebook code block is still there then at the end of it you will need to add
around line 104 look for
PHP Code:
//// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
and insert below
PHP Code:
if ($facebook_add == 1) {
And again there is the second block of facebook code to which you will need to add this to the end of the facebook code block
I just tested this and it is still adding a product to fb when I choose the option to add it. BUT, and this may have been sorted or not with other versions, the html in the description like <p> is included in the fb listing and is not stripped/converted by fb like it used to be. I looked into it and it's an easy fix. In update_products if there is this line (it's there twice in mine)
PHP Code:
$prod_description = $_POST['products_description'][$_SESSION['languages_id']];
change to
PHP Code:
$prod_description = strip_tags($_POST['products_description'][$_SESSION['languages_id']]);
and now all html tags are stripped from the product description.
Also, my changes in update_product should be able to be applied to newer/different versions of the module as long as the last 2 edits ( adding if ($facebook_add == 1) { and then the closing } at the end of the block) are added wherever the new fb code blocks are. I say should, because I can't say for sure if it will work since I haven't tried it.
I am using the version 2.0 and it's working perfectly especially now I got the html tags stripped from the product descriptions, so I have never bothered to change what ain't broke. Like I said, this may or may not work with newer versions. I can try to help if there are major changes in the code in the new version.
Re: AutoFacebook [Support]
I looked at the new version and my code should work with it and I see they have addressed the strip tags in this version.
Please also note, once you have added the product to fb, if you go back in to edit/update your product you might want to switch the "add to facebook" to no so it won't add the same product again once you update it. Otherwise it will be added to fb again.
Re: AutoFacebook [Support]
Hi Lankee,
Firstly I am not a coder :smile: I am using autofacebook v2.1 on ZC v1.3.9h
I have modified files as per your instructions and now get this in the admin/products pages and nothing else, the whole 'form' is not showing;
1054 Unknown column 'p.facebook_add' in 'field list'
in:
[select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_virtual, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id, p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute, p.product_is_free, p.product_is_call, p.products_quantity_mixed, p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max, p.products_sort_order, p.products_discount_type, p.products_discount_type_from, p.products_price_sorter, p.master_categories_id, p.facebook_add from products p, products_description pd where p.products_id = '62' and p.products_id = pd.products_id and pd.language_id = '1']
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.
I have double checked everything and am confident I have put all the code in the right places, with the exception of;
In admin/includes/modules/update_product.php around line 104 look for
PHP Code:
//// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
and insert below
PHP Code:
if ($facebook_add == 1) {
And again there is the second block of facebook code to which you will need to add this to the end of the facebook code block
PHP Code:
}
in my file it shows;
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
//// *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
///////////////////////////////////////////////////////
i.e., nothing in between the instructions titles so I added code- if ($facebook_add == 1) {
and because there does not appear to be any other block of code that does not already have the } at the end of it, I inserted it as follows;
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////
if ($facebook_add == 1) {
}
//// *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
///////////////////////////////////////////////////////
I have obviously done something wrong - any ideas where I may have slipped up? Do you need me to post the whole of all the files as modified?
cheers,
Mike
p.s. the facebook_add was successfully added to the db table via myphpAdmin
Re: AutoFacebook [Support]
what version of zc are you using? Also, can you confirm in phpmyadmin that facebook_add is definitely in the products table?