有谁知道如何从Magento的视图文件中获取属于特定类别的产品列表?
在WooCommerce中,我需要将所有产品价格乘以一个数字.所以我使用了以下内容(通过插件):
add_filter('woocommerce_get_regular_price', array( $this, 'my_custom_price'), 99);
add_filter('woocommerce_get_price', array( $this, 'my_custom_price'), 99);
function my_custom_price( $original_price ) {
global $post, $woocommerce;
//Logic for calculating the new price here
$new_price = $original_price * 2;
//Return the new price (this is the price that will be used everywhere in the store)
return $new_price;
}
Run Code Online (Sandbox Code Playgroud)
但是,这对变体产品不起作用.我试过以下钩子没有运气:
add_filter('woocommerce_get_variation_regular_price', array( $this, 'my_custom_price'), 99);
add_filter('woocommerce_get_variation_price', array( $this, 'my_custom_price'), 99);
Run Code Online (Sandbox Code Playgroud)
唯一有效的是这一个:
add_filter('woocommerce_variation_prices_price', array( $this, 'my_custom_price'), 99);
Run Code Online (Sandbox Code Playgroud)
但这只是改变了整体价格,而不是选定的变化价格.见下图,价格是BsF.200和整体价格是正确的,200 x 2 = 400,但选择时的变化价格仍显示200:
注意:我需要它实际更改,所以显示html钩子不会工作.
有什么我想念的,或者有什么不对吗?
我正在为内部客户开发一个应用程序.其中一个要求是,它的开发方式可能会被出售给其他组织.该应用程序是一个筹款组织的跟踪应用程序,将管理他们的捐赠,捐赠者,参与者和事件.我已经知道我需要开发一个用于身份验证的插件架构(授权将在内部处理)并从外部目录派生人口统计数据.
该应用程序将基于ASP.NET/C#/Linq/SQL Server构建.在这一点上,我并不是真的愿意支持替代数据库,但我想如果有必要,我可以通过不同的Linq驱动程序在未来做到这一点.
我迄今为止构建的所有Web应用程序都是自定义实现,因此我想知道是否还需要通过插件和/或配置项来解决其他问题.任何输入都会有所帮助.
谢谢.
iTunes Connect接受应用程序的名称以包含"+"之类的符号.但是,当我尝试使用包含"+"的Xcode项目名称提交应用程序时,我收到错误,即项目名称或应用程序名称(或产品,不记得哪个)不能包含"+"之类的符号".所以我最终删除了产品名称中的"+"符号.因此,App Store上的名称包含"+",但在设备上安装时,名称不包含符号"+".如何在下次提交时解决此问题?设备上的应用名称是什么名称?它如何包含"+"并通过测试提交?
我正在使用Magento API来获取来自其他域的特定类别的产品的产品数据.我已经进行了API调用等...我目前用于获取产品数据的代码如下所示:
$productList = $client->call($session, 'catalog_category.assignedProducts', 7);
foreach ($productList as $product){
$theProduct = array();
$theProduct['info'] = $client->call($session, 'catalog_product.info', $product['sku']);
$allProducts[] = $theProduct;
}
Run Code Online (Sandbox Code Playgroud)
代码工作正常,但速度非常慢.当我将图像调用添加到循环时,页面加载大约需要50秒,而这只适用于只有5个产品的网站.我想知道的是以下内容:
任何帮助将非常感激.至少如果我知道我正在使用正确的代码,我可以看看其他途径.
提前致谢!
=================编辑=================
使用Matthias Zeis建议的multicall,数据更快地到达.这是我使用的代码:
$apicalls = array();
$i = 0;
$productList = $client->call($session, 'catalog_category.assignedProducts', 7);
foreach ($productList as $product){
$apicalls[$i] = array('catalog_product.info', $product['product_id']);
$i++;
}
$list = $client->multiCall($session, $apicalls);
Run Code Online (Sandbox Code Playgroud)
现在这比以前快得多!我发现的下一个问题是,catalog_product_attribute_media.list调用似乎没有以相同的方式工作,即使产品都设置了图像.
我在var_dump中得到的错误是:
产品图片库中不存在请求的图片.
有谁知道为什么现在可能会发生这种情况?再次感谢您的提前.
如果我点击"启动Eclipse应用程序"按钮,我只是导出了一个运行良好的产品.如果尝试执行导出的产品,我会在启动时遇到以下异常:
!SESSION 2012-03-16 17:28:21.206 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.6.0_26
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=de_DE
Command-line arguments: -os linux -ws gtk -arch x86_64
!ENTRY org.eclipse.osgi 4 0 2012-03-16 17:28:22.184
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: No application id has been found.
at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242)
at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Run Code Online (Sandbox Code Playgroud)
就在我导出产品之前,我对依赖项进行了验证,这很好.你有什么问题吗?谢谢!
我试图通过使用以下方法从Woocommerce的订单中提取项目元值:
$data = wc_get_order_item_meta( $item, '_tmcartepo_data', true );
Run Code Online (Sandbox Code Playgroud)
但是,我找不到将order_item_id作为第一个参数的方法(使用get_items)
global $woocommerce, $post, $wpdb;
$order = new WC_Order($post->ID);
$items = $order->get_items();
foreach ( $items as $item ) {
$item_id = $item['order_item_id']; //???
$data = wc_get_order_item_meta( $item_id, '_tmcartepo_data', true );
$a = $data[0]['value'];
$b = $data[1]['value'];
echo $a;
echo $b;
}
Run Code Online (Sandbox Code Playgroud)
我的意思是这个订单item_id(1和2)
我该怎么办?
谢谢.
$cart_item = $woocommerce->cart->get_cart();
Run Code Online (Sandbox Code Playgroud)
我有上面的代码.
如果我在cart_item上运行print_r,我会得到一个多维数组:
Array( [a6292668b36ef412fa3c4102d1311a62] => Array ( [product_id] => 6803
Run Code Online (Sandbox Code Playgroud)
我如何才获得product_id?
我试过$ test = $cart_item['data'];
print_r($test);
Run Code Online (Sandbox Code Playgroud)
没工作.
在我的公司,我们开发了一个软件产品.到目前为止,我们还没有任何测试人员,所以基本上开发人员都是测试人员,当然还有客户和用户(不好).
我们的团队现在由4名开发人员组成,我们主要使用Cruisecontrol,Flex,ASP.NET,IIS,MSSQLServer和WebORB.我敦促管理人员聘请测试人员,但我想知道测试人员在软件开发方面是否正常.所以:
thx,Lieven Cardoen
ps:Thx,Vinay,我们确实有单元测试,但实际上,单元测试不能涵盖测试人员可以做什么.
product ×10
php ×4
magento ×3
woocommerce ×3
wordpress ×3
api ×1
architecture ×1
asp.net ×1
c# ×1
cart ×1
catalog ×1
categories ×1
eclipse-rcp ×1
export ×1
ios ×1
orders ×1
price ×1
project ×1
soap-client ×1
submission ×1
testing ×1
xcode ×1