在进行drupal 6到7升级时,我收到的消息并不那么有用"网站遇到意外错误.请稍后再试." 每次我去某些页面.ex)/ admin/config
找出导致致命错误的原因的最佳方法是什么,以便我可以修复它?
我现在能想到的就是在该页面工作或查看日志之前开始禁用提供的模块.
谢谢.
我必须在购物车中添加一些自定义金额的订单项.商品保存,价格= 0,我的模块计算价格并将订单项添加到购物车/订单,但我不明白如何以编程方式设置价格.
我已经阅读了有关使用规则的内容,但我需要我的模块才能设置/更改价格,而无需调用规则.
我尝试使用实体包装器,我尝试更改使用commerce_product_line_item_new()创建的订单项,但什么都没有,当订单项进入购物车时始终具有原始产品价格(在我的情况下为0).
如何以编程方式更改订单项价格?
到目前为止我的代码看起来像:
// For debugging, this function is called by hook_menu()
function mymodule_test($product_id)
{
global $user;
$user = user_load($user->uid);
$order = commerce_cart_order_load($user->uid);
$order_wrapper = entity_metadata_wrapper('commerce_order', $order);
$product = commerce_product_load($product_id);
$line_item = commerce_product_line_item_new(
$product,
1,
0,
array(
),
'cover'
);
$line_item_wrapper = entity_metadata_wrapper("commerce_line_item", $line_item);
$line_item_wrapper->commerce_unit_price->data = commerce_price_component_add(
$line_item_wrapper->commerce_unit_price->value(),
'base_price',
array(
'amount' => 1234,
'currency_code' => 'EUR',
'data' => array(),
),
TRUE
);
$insert_line_item = commerce_cart_product_add($user->uid, $line_item_wrapper->value(), FALSE);
return 'done';
}
Run Code Online (Sandbox Code Playgroud)
奇怪的是,我尝试调整在commerce/modules/line_item/commerce_line_item.rules.inc中找到的commerce_line_item_unit_price_amount()的代码,但是这个测试:
<?php
global $user;
$product …Run Code Online (Sandbox Code Playgroud) 我一直使用Drupal 6一年,并且每个项目都使用Zen Sub-Theme.那么,我应该继续使用Zen for Drupal 7吗?或者Drupal 7带来了更好的选择?也许Stark的主题?
我有一个Drupal 7多语言(3)网站.我已经安装了Internationalization(7.x-1.0-beta2)模块.
我为每种语言创建了一个页面,并将其翻译成另外两种语言.
现在这就是我想要做的事情:设置一种智能的"头版"以了解所选择的语言并设置该语言的首页(我选择).
我怎样才能做到这一点?我知道在国际化模块中,没有这样的东西,我是对的吗?如果我将首页设置为空,我会收到以下消息:"还没有创建首页内容."这是正常的,因为Drupal要求我设置一个首页,但是我想要为每种语言设置一个首页.
multilingual drupal internationalization drupal-7 drupal-modules
我使用以下模块:
并希望在模板(.tpl)中呈现Youtube视频的缩略图.我应该使用哪种主题功能和什么参数?
我最好的问题是:
$my_media['style_name'] = 'unlinked_thumbnail';
print theme('file_styles',$my_media);
Run Code Online (Sandbox Code Playgroud)
其中$ my_media是一个包含fid,uri,filename,filemime等的数组.
由于我对Drupal很新,所以我尝试理解模块源代码都失败了.我觉得我已经尝试了在youtube和样式模块中定义的样式名称的所有可能组合,但没有得到任何输出.
然而,渲染视频本身就可以正常使用
print theme('media_youtube_video',$my_media);
Run Code Online (Sandbox Code Playgroud)
你们是怎么做到的?
如何将视图导入Drupal.我有一个导出的视图,我需要在不同的Drupal安装中导入.我在admin/structure/views中没有导入选项?
谢谢!
编辑:
我找到了解决方案.我必须以用户1登录才能获得此选项.
如何设置Drupal 7的登录页面的样式?我喜欢用不同的方法page-user-login.tpl或user-login.tpl的page-login.tpl,但没有结果.
有没有一种简单的方法可以在他自己的.tpl文件中使用Drupal 7中的登录页面进行主题化?
在我的自定义模块中,我想添加注释功能.我尝试了几件事,但到目前为止还没有锻炼.
// render comments form
$output .= theme('my_module_front_page');
$comment = new stdClass;
$comment->nid = $node_good_practice->nid;
$output .= render(drupal_get_form('comment_form', $comment));
return $output;
Run Code Online (Sandbox Code Playgroud)
上面的代码将注释表单放到我的节点页面.
但是当我填写评论表并提交时,它会将我重定向到这个页面:comment/reply/node id然后我必须重新填写我的评论并且评论不会被保存.
我想提交并保持在同一页面而不是重定向.提交后必须保存评论.
现在,评论表单出现在我的节点页面(自定义模块模板)上.我输入评论并点击"保存".我被发送到/comment/reply/<node_id>,但所有评论字段都是空的.评论也没有保存.
我想要发生的是:
添加重定向
$form['#redirect'] = "/success-stories/".$node_good_practice->good_practice_name."/".$node_good_practice->nid;
Run Code Online (Sandbox Code Playgroud)
它没有改变任何东西.
改变行动
$form['#action'] = "/success-stories/".$node_good_practice->good_practice_name."/".$node_good_practice->nid;
Run Code Online (Sandbox Code Playgroud)
它将我重定向到 node/node_id/#comment-17
使用 drupal_build_form()
$info->nid = $node_good_practice->nid;
$comment['build_info']['args'][0] = $info;
$comment['redirect'] = "http://www.google.nl";
$output .= render(drupal_build_form('comment_form', $comment));
Run Code Online (Sandbox Code Playgroud)
表单正在显示,但不会重定向; 它发送给comment/reply/node_id.
在我的网站(使用drupal运行)中,该ob_flush函数需要很长时间(在10到100秒之间)才能执行.我如何找出原因?什么能导致这么长时间?

我正在使用" 分类显示 "模块.我使用这样我可以按标题而不是ID来排序我的分类术语,就像默认情况下那样.但是,我还创建了一个名为的分类模板:
taxonomy-term--product_literature_category.tpl.php
Run Code Online (Sandbox Code Playgroud)
如果我启用" 分类显示 "模块并覆盖此路径的分类视图:
/taxonomy/term/%
Run Code Online (Sandbox Code Playgroud)
...它还会覆盖我上面指定的模板.更有意义的是,订单将使我的自定义模板覆盖模块.但它似乎没有这样的方式.但是,如果我禁用"分类法显示",它会再次考虑我的模板.
我有两个选择:
我认为1很难(因为对同一件事使用两个模板没有多大意义).这就是为什么我倾向于在默认情况下更简单地对分类视图进行排序,或者以其他方式指定分类术语的顺序.
有谁知道如何做到这一点?
UPDATE
现在,我将解决一个问题,即通过模块更改分类术语的排序.这样我就可以只覆盖特定词汇表的排序.任何能够在这个方向上轻推我的指针都会受到高度赞赏吗?
更新2
我创建了teaser_sorter.module并添加了这个函数:
function teaser_sorter_views_query_alter(&$view, &$query)
{
print '<pre>'; print_r($view); print_r($query); die();
}
Run Code Online (Sandbox Code Playgroud)
我还确保我的模块支持视图:
function teaser_sorter_views_api() {
return array(
'api' => 3,
);
}
Run Code Online (Sandbox Code Playgroud)
我无法让它达到我的"死".换句话说,它永远不会被称为.事实上,我也尝试重写"hook_views_pre_execute",但这也不会被调用.
有任何想法吗?
drupal-7 ×10
drupal ×8
php ×2
drupal-views ×1
import ×1
login ×1
multilingual ×1
performance ×1
starter-kits ×1
taxonomy ×1
themes ×1
upgrade ×1
views ×1