
Originally Posted by
conor
Yes, you'd have to add custom for each custom product type the store uses.
ceon
I've just spent some time debugging this and thought I'd post here to help others in the same situation. If I've missed documentation covering this, please accept my apologies. If I haven't missed docs, please add some to this effect :) it would have saved some head scratching. This is pretty simple stuff, but hard to get into as a newcomer to the URI Mapping mod.
We have a custom product type "product_light" which was created following the standard Zen Cart approach of copying an existing product type, in my case the product_music files, and hacking the custom attributes to our requirements.
1/ We therefore have a custom admin/includes/modules/product_light/update_product.php, so the update_product action causes this update_product.php to be executed when saving changes to products, due to the code in admin/product.php that runs your custom update_product.php if it exists. So we have to copy the CEON modifications from admin/includes/modules/update_product.php to make any URI mappings be saved to the database. There's only one block, marked with "CEON URI MAPPING 1 of 1".
2/ We need a constant for our product type filename, just so we don't have to hardcode the string anywhere, so in includes/extra_datafiles/our_custom_stuff.php we include:
Code:
define('FILENAME_PRODUCT_LIGHT_INFO', 'product_light_info');
I am not clear whether this needs doing for admin/includes/extra_datafiles/our_custom_stuff.php also.
3/ Update includes/classes/class.CeonURIMappingHREFLinkBuilder.php to ADD line 238:
Code:
$main_page == FILENAME_PRODUCT_LIGHT_INFO ||
4/ Update includes/classes/class.CeonURIMappingHandler.php to ADD line 442:
Code:
$_GET['main_page'] == FILENAME_PRODUCT_INFO ||
and line 513:
Code:
$_GET['main_page'] == FILENAME_PRODUCT_LIGHT_INFO ||
5/ Update admin/includes/classes/class.CeonURIMappingAdminProductPages.php to ADD line 940:
Code:
FILENAME_PRODUCT_LIGHT_INFO,
and line 1436:
Code:
FILENAME_PRODUCT_LIGHT_INFO,
With these modifications in place, the URI mappings for our custom product types seem to work.
In summary, it would be nice if some of theses lists of FILENAME_* constant usages were driven by the product_types database table, if possible, as that would reduce the necessity to hardcode these lists of known product types, but perhaps it isn't that simple.
Bookmarks