Hi David
I am try something different for feed register.
Suppose 4 Feeds
1st feed :
This is Main feed and I am manually add all product details .I am only add product title,Image URL,Description Category and Sub-category in this feed.So this Feed only reference for main Details
2nd,3rd and 4th Feeds :
This all 4 feeds given by different merchant ......In This feeds all details given by merchant ...But i am only want to used Product price,Buy URL and shipping-charges of that feeds.
example like
- I am add one mobile product "Nokia Asha 302" on 1st feed
- On 2nd feed merchant give product name " Nokia asha 302 Mobile Phone"
- On 3rd feed merchant give product name " Nokia asha 302 DUAL Mobile "
- On 4th feed merchant give product name " Nokia 302 Asha DUAL Mobile "
So here I am create product mapping for "Nokia Asha 302"
whatever merchant gives category,sub-category,title in 2nd,3rd and 4th Feed.... But script only fetch from 1st Feeds
only Buy-URL,price,shipping depends on 2nd,3rd,4th feed
So can possible to register 1st feed without price column ???
and possible to register 2nd,3rd,4th feed without image-url,Description,Category,Sub-Category ??
Hi David ...above code working on custom.php but some error in includes/admin.php...can you send me admin.php with include above code..
technoarenasol
Hi david .thanks for email me modify admin.php...I replace this file with old file..so what can i do now ??
Actually I am not clearly understanding your idea..can you tell me stepwise procedure for better understanding...
Hi technoarenasol,
You don't have to do anything now - other than maintain your custom.txt file. What I did was combine the functionality of the above code (from custom.php) into the admin_importReviews() function in includes/admin.php. This function is called at the end of every import process - whether you import a single feed from /admin/ or when all feeds are imported via the automation scripts - so now after every import your custom descriptions etc. will be imported from custom.txt for you...
Cheers,
David.
--
PriceTapestry.com
Hi david
when i am register any feed one error massage come
Warning: Cannot modify header information - headers already sent by (output started at /home/....../includes/database.php:55) in /home/.......admin/feeds_import.php on line 31
Hi,
The warning indicates that you have database debug mode enabled - when not working on modifications turn debug mode back off by changing line 6 in config.advanced.php back to
$config_databaseDebugMode = FALSE;
The reason being, that "intentional" errors can occur during import as a reult of the duplicate prevention mechanism (DUPLICATE KEY) so debug mode should always be turned off when not required...
Cheers,
David.
--
PriceTapestry.com
Hi
David thnx for replay ...David you check my last replay?.... can you tell me idea good or not...its possible or not
Hi technoarenasol,
Is your custom import not working or did you want to do it a different way now?
Cheers,
David.
--
PriceTapestry.com
technoarenasol
I also don't know where is custom.txt
Sorry technoarenasol,
I meant master.csv - it should be in your /feeds/ folder...
Cheers,
David.
--
PriceTapestry.com
technoarenasol
Step 1: I create master.csv file and Insert into /feeds/
Srep 2: I Insert Merchant1.csv file into /feeds/
Step 3 :I add your code into custom.php and testing done after that I replace admin.php with your modified admin.php in includes folder
Step 4 : I Register merchant1.csv file and import ....so now don't know how can be possible to also import custom description from master.csv
because In master.csv feed product name may be different like "Nokia asha 302 " and in Merchant feed product name like " Nokia asha 302 Mobile phone "
Hi technoarenasol,
Ah OK - I see where you've got to now - so the process is working, but now it is down to Product Mapping.
For your example, if you create a new Product Mapping with name
Nokia asha 302
(this must match the name that you use in your master.csv file)
...and in the Alternatives box on the configuration page for the mapping, enter
=Nokia asha 302 Mobile phone
Then, then merchant1.csv is imported, the product "Nokia asha 302 Mobile phone" will be renamed to "Nokia asha 302". Then it will match the name in your master.csv custom fields feed and your custom fields will be set by the modification described above!
Hope this helps!
Cheers,
David.
--
PriceTapestry.com
technoarenasol
Yes..this is solution ...I think its difficult way ..because you say no need of register master.csv file and I am use helper.php for mapping..
Not display master.php prdouct name in helper.php If I am not register master.php file...
So its difficult if large number of products
Hi,
I'll follow up by email with some ideas for you...
Cheers,
David.
--
PriceTapestry.com
technoarenasol
Thanks David...Now I follow your advice which you tell me..description.category,sub-category are automatically taken from master.csv .....but one problem is when I set $config_nicheMode = TRUE; but still products display which I am not Products mapping
Hello technoarenasol,
In includes/admin.php please look for the following code around line 318:
if (!in_array($importRecord["name"],$admin_importProductMappings)) return;
...and REPLACE that with:
if (!isset($admin_importProductMappingsOverrides[$importRecord["name"]])) return;
Cheers,
David.
--
PriceTapestry.com
technoarenasol
David ...I am replace code with if
(!isset($admin_importProductMappingsOverrides[$importRecord["name"]])) return;
Hi technoarenasol,
That looks fine but the "if" is missing - can you check your modification incase it was missed off the copy & paste... finally, please double check your config.advanced.php that line 53 is:
$config_nicheMode = TRUE;
If it's still not working, please could you attach in an email your config.advanced.php and includes/admin.php and I'll check it out for you...
Cheers,
David.
--
PriceTapestry.com
technoarenasol
Hi David
Today I add some product in master.csv (Modify)... After that I import all feeds which already registered. So After import feed can not get category and brand field from master field.
include/admin.php custom function :
function myCustomRecordHandler($record)
{
global $config_databaseTablePrefix;
$sql = "UPDATE `".$config_databaseTablePrefix."products` SET
brand='".database_safe($record["brand"])."',
category='".database_safe($record["category"])."',
MobileAccessories='".database_safe($record["MobileAccessories"])."',
mabrand='".database_safe($record["mabrand"])."',
description='".database_safe($record["description"])."',
image_url='".database_safe($record["image_url"])."',
simg='".database_safe($record["simg"])."'
WHERE
name='".database_safe($record["name"])."'";
database_queryModify($sql,$result);
}
I Dont understand why brand and category not fetch from master file
Hi technoarenasol,
I see you added quite a few fields to the SQL to update from master.csv, so perhaps to check that the SQL is OK could you try running your full import now with $config_databaseDebugMode = TRUE; (line 6 of config.advanced.php) and that will indicate if there is any problem with the SQL which could be why category/brand are not updating...
If there is no MySQL error, or you are still not sure from the debug output what the problem might be let me know what is displayed and I'll check it out for you...
Cheers,
David.
--
PriceTapestry.com
technoarenasol
Message after feed import :
[INSERT INTO `ptmobile_products` SET filename='landmark.csv', name='SAMSUNG E1232',description='',image_url='',buy_url='http://partners.shoogloonetwork.com/z/111638/CD12922/',price='1675.00',mabrand='',shipday='',category='',brand='',original_name='SAMSUNG E1232 TITANIUM SILVER',merchant='landmark', search_name='SAMSUNGE1232', normalised_name='SAMSUNG E1232', dupe_hash='7f5990d961737e79d3a43eb2ff0777' ][Duplicate entry '7f5990d961737e79d3a43eb2ff0777' for key 2][INSERT INTO `ptmobile_products` SET filename='landmark.csv', name='Nokia C2-00',description='',image_url='',buy_url='http://partners.shoogloonetwork.com/z/111653/CD12922/',price='2399.00',mabrand='',shipday='',category='',brand='',original_name='Nokia C2-00 Black',merchant='landmark', search_name='NokiaC2-00', normalised_name='Nokia C2 00', dupe_hash='e01c1cd089b58ee63897a416937f6c' ][Duplicate entry 'e01c1cd089b58ee63897a416937f6c' for key 2]
Hi technoarenasol,
Those SQL errors are part of the import / duplicate prevention process (they are not errors as such they are expected but only show up if database debug mode is on.
So I wonder then if maybe the format of your master.csv file has become. The code above assumes Quoted Text, Header Row, Comma Separated - I know you are including custom descriptions in your master.csv so if these contains commas; double check that the full description is in "quoted text" as that may cause certain records - or more likely certain fields (e.g. the category and brand that you are missing) to be skipped over....
Let me know if you're still not sure - if you wanted to email me your master.csv I'll dobule check the format for you...
Cheers,
David.
--
PriceTapestry.com
Hi technoarenasol.
Rather than try to change the registration system, it will be much easier to import your "master" feed as a separate process after the main import, and from it; update the `products` table with your custom image_url, description, category and subcategory.
I assume you will make this file as CSV file (quoted text, header row as below, comma separated), let's say "master.csv" in your /feeds/ folder with this format:
"name","description","image_url","category","subcategory"
"Product 1","Description 1","http://www.example.com/images/1.jpg","Master Cat","Sub Cat"
"Product 2","Description 2","http://www.example.com/images/2.jpg","Master Cat","Sub Cat"
With that in place, create a script to import your custom content as follows:
scripts/custom.php:
<?php
set_time_limit(0);
require_once("../includes/common.php");
require_once("../includes/MagicParser.php");
function myRecordHandler($record)
{
global $config_databaseTablePrefix;
$sql = "UPDATE `".$config_databaseTablePrefix."products` SET
description='".database_safe($record["description"])."',
image_url='".database_safe($record["image_url"])."',
category='".database_safe($record["category"])."',
subcategory='".database_safe($record["subcategory"])."'
WHERE
name='".database_safe($record["name"])."'
";
database_queryModify($sql,$result);
}
MagicParser_parse($config_feedDirectory."master.csv","myRecordHandler","csv|44|1|34");
print "Done.";
?>
With the above script in place, browse to scripts/custom.php to test. When all is working well, you can incorporate this as part of the import process by adding the above code but without the PHP tags to the end of the admin_importReviews() function in includes/admin.php - immediately before the closing } at line 547 in the distribution version (which is called at the end of any import process) and that should do the trick...
(note that for the above to work, subcategory must have been added as a custom field to your products table)
Regarding your other post about sub-directory searching, I will follow up by email in just a moment with some code for you to try...
Cheers,
David.
--
PriceTapestry.com