唯一产品URL的WP电子商务修复程序
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了唯一产品URL的WP电子商务修复程序相关的知识,希望对你有一定的参考价值。
This snippet of code added to line 1404 of wpsc_query.php finds a single product by the product url AND category its in. The default is to only look up a product by its url only, not including the category, meaning you can't have a product in more than one category with the same name.
// ATD 22.DeireadhFomhair.2010 - find a unique product if it has the same product url as something else $page_url = $_SERVER['REQUEST_URI']; $product_url = $this->query_vars['product_url_name']; $products_url = get_option('product_list_url'); $siteurl = get_option('siteurl'); $category_url = $matches[1]; $product_id = $wpdb->get_var("SELECT pm.`product_id` FROM `".WPSC_TABLE_PRODUCTMETA."` pm, `".WPSC_TABLE_PRODUCT_CATEGORIES."` pc, `".WPSC_TABLE_ITEM_CATEGORY_ASSOC."` ca WHERE `meta_key` IN ( 'url_name' ) AND `meta_value` IN ( '".stripslashes($this->query_vars['product_url_name'])."' ) AND pc.id = ca.category_id AND pm.product_id = ca.product_id AND pc.`nice-name` = '".stripslashes($category_url)."'"); }
以上是关于唯一产品URL的WP电子商务修复程序的主要内容,如果未能解决你的问题,请参考以下文章
WooCommerce REST API产品图像相对URL问题