0

好的,我在http://sergedenimes.com/products-page/有一家商店

它使用 wordpress 上的 wp 电子商务插件。我已经修改了主题文件以获得我想要的外观和布局,但前几天另一个站点用户冒昧地更新了插件而不备份文件,从而覆盖了我的更改。

(我知道这不应该发生,我应该将主题文件放在不同的目录中,但这是一个不同的问题)

无论如何,幸运的是,我设法将几乎所有主题文件恢复到我的主题文件中,商店又恢复了原样,除了一件事:在结帐页面上有一个下拉菜单,用户可以在其中选择他们的国家,以便商店可以计算运输成本。此下拉列表中现在没有列出任何国家/地区。我检查了结帐主题文件,它的<?php echo wpsc_shipping_country_list();?>标签在正确的位置。

任何想法为什么国家列表不再填充选择?我该如何解决?

(为了亲自查看,您需要将至少一种产品添加到购物车并结账)

谢谢

编辑回答马蒂的观点:

  • 总价将始终包括运费 - 它是实物商品并添加运费。默认发货国家/地区是英国,这就是它增加 3.60 英镑的原因
  • 不知道邮政编码框。你能提供截图吗?对我来说,它没有说明提供邮政编码 - 它说“请在下面选择一个国家来计算您的运费”(应该如此)然后有一个下拉菜单,其中没有可供选择的选项。(这是我的问题)。我在这里看不到文本字段,也不应该有。
  • 尽管可能在加拿大服务器上,但该网站和公司位于英国,因此货币反映了这一点
  • 感谢您的链接,尽管它似乎不包含解决方案。尝试停用/重新激活,现在购物车小部件中的结帐链接转到错误的页面。

(确定修复了购物车小部件链接问题,但国家下拉菜单仍然损坏)

另一个编辑:这是我的整个结帐页面模板文件的粘贴箱:http: //pastebin.com/aGxqsTVt

更新:所以我尝试检查核心文件中的查询并将 wp_ 前缀添加到表名中,但没有成功。仍然在为此苦苦挣扎,似乎更新搞砸了很多事情,包括商店现在正在展示保存为草稿的产品。

任何建议都非常感谢。

好的,所以我在其中添加了一个 php 和 mysql 标记,因为我认为这就是问题所在。

这是我认为应该生成国家/地区列表的功能:

function wpsc_shipping_country_list( $shippingdetails = false ) {
global $wpdb, $wpsc_shipping_modules, $wpsc_country_data;
$js = '';
$output = '';
if ( !$shippingdetails ) {
    $output = "<input type='hidden' name='wpsc_ajax_actions' value='update_location' />";
    $js = "  onchange='submit_change_country();'";
}
$selected_country = (string) wpsc_get_customer_meta( 'shipping_country' );
$selected_region  = (string) wpsc_get_customer_meta( 'shipping_region'  );

if ( empty( $selected_country ) )
    $selected_country = esc_attr( get_option( 'base_country' ) );

if ( empty( $selected_region ) )
    $selected_region = esc_attr( get_option( 'base_region' ) );

if ( empty( $wpsc_country_data ) )
    $country_data = $wpdb->get_results( "SELECT * FROM `" . WP_WPSC_CURRENCY_LIST . "` WHERE `visible`= '1' ORDER BY `country` ASC", ARRAY_A );
else
    $country_data = $wpsc_country_data;

$acceptable_countries = wpsc_get_acceptable_countries();

$output .= wpsc_get_country_dropdown( array(
    'name'                  => 'country',
    'id'                    => 'current_country',
    'additional_attributes' => $js,
    'acceptable_ids'        => $acceptable_countries,
    'selected'              => $selected_country,
    'placeholder'           => '',
) );

$output .= wpsc_shipping_region_list( $selected_country, $selected_region, $shippingdetails );

if ( isset( $_POST['wpsc_update_location'] ) && $_POST['wpsc_update_location'] == 'true' ) {
    wpsc_update_customer_meta( 'update_location', true );
} else {
    wpsc_delete_customer_meta( 'update_location' );
}

$zipvalue = (string) wpsc_get_customer_meta( 'shipping_zip' );
if ( ! empty( $_POST['zipcode'] ) )
    $zipvalue = $_POST['zipcode'];

$zip_code_text = __( 'Your Zipcode', 'wpsc' );

if ( ( $zipvalue != '' ) && ( $zipvalue != $zip_code_text ) ) {
    $color = '#000';
    wpsc_update_customer_meta( 'shipping_zip', $zipvalue );
} else {
    $zipvalue = $zip_code_text;
    $color = '#999';
}

$uses_zipcode = false;
$custom_shipping = get_option( 'custom_shipping_options' );
foreach ( (array)$custom_shipping as $shipping ) {
    if ( isset( $wpsc_shipping_modules[$shipping]->needs_zipcode ) && $wpsc_shipping_modules[$shipping]->needs_zipcode == true ) {
        $uses_zipcode = true;
    }
}

if ( $uses_zipcode ) {
    $output .= " <input type='text' style='color:" . $color . ";' onclick='if (this.value==\"" . esc_js( $zip_code_text ) . "\") {this.value=\"\";this.style.color=\"#000\";}' onblur='if (this.value==\"\") {this.style.color=\"#999\"; this.value=\"" . esc_js( $zip_code_text ) . "\"; }' value='" . esc_attr( $zipvalue ) . "' size='10' name='zipcode' id='zipcode'>";
}
return $output;
}
4

2 回答 2

0

我更新时遇到了完全相同的问题。我发现问题的原因是从英国到英国的转变。确保您在管理员中使用英国而不是旧英国,您的问题应该得到解决。

坦率。

于 2013-04-03T13:59:22.267 回答
0

好的,看看最新版本的 checkout.class.php 文件似乎没有使用 $wpdb->prefix 你在数据库表上使用前缀吗?不只是 wp_ 吗?

$country_data = $wpdb->get_results( "SELECT * FROM `" . WPSC_TABLE_CURRENCY_LIST . "` WHERE `visible`= '1' ORDER BY `country` ASC", ARRAY_A );

应该是什么?

$country_data = $wpdb->get_results( "SELECT * FROM `" . $wpdb->prefix.WPSC_TABLE_CURRENCY_LIST . "` WHERE `visible`= '1' ORDER BY `country` ASC", ARRAY_A );

检查 phpmyadmin 中的数据库结构以查看表名是否匹配?

[更新] 是的,刚刚通读安装文件,他们使用前缀,但仍然检查以确保这些表中仍有数据?

于 2012-10-31T17:03:07.880 回答