Catalog in D7 with taxonomy term synonym as an argument
I have a question: I'm creating a product catalog on Drupal Commerce similar to this store http://czech-cristal.ru. I created a taxonomy vocabulary called "Product Categories" with the names of the required products, where the "Pattern for all Product Categories paths" is set to catalog/[term:name]. Of course, based on this vocabulary, I also created a menu that links to Views (path catalog/%) with argument passing.
I need the links to specifically appear as catalog/[term:name], just like on http://czech-cristal.ru.
So, moving on, here are the issues I've encountered. I entered the taxonomy terms, and the menu appeared with links catalog/obuv-timberland and catalog/novyy-termin. I created
Views with the URL catalog/%, set a contextual filter for "Content: Has taxonomy term ID (with depth)", and in the validation criteria, I selected PHP code, writing the following code:
$url = drupal_lookup_path('source', "catalog/".$argument); if ($url != false) { // if the path is found, check that it is a taxonomy term path // $term_base_path = 'taxonomy/term/'; if (strncmp($term_base_path, $url, strlen($term_base_path)) == 0) { // remove the prefix 'taxonomy/term/', convert the remaining value to a number // and replace the view's argument with the obtained taxonomy term ID // $handler->argument = intval(str_replace($term_base_path, '', $url)); } } return TRUE;
So, in the Views itself, everything displays correctly as it should. It shows the necessary products depending on the term (screenshot 1). My problem is that on the actual site at the addresses catalog/obuv-timberland and catalog/novyy-termin, it does not display what is shown in the preview in Views, but rather the materials associated with these taxonomy terms in order (screenshot 2). Please advise how to ensure that the products in the catalog are displayed on the site as they are in the Views preview.