gpt4 book ai didi

php - 如何在 zencart for PHP 中获取类别 ID?

转载 作者:行者123 更新时间:2023-11-30 22:35:59 25 4
gpt4 key购买 nike

我是 zencart 的新手,但对 php 也完全不熟悉。我想问的是:如何为我的 php 代码获取一个特定类别中的所有产品?我的店铺在这里: http://www.polish-your-art.com/boutique/index.php?main_page=index&cPath=29在这种情况下,类别是“支付你想要的”id 29。我使用来自 zencart 论坛的非常好的代码,但它是否仅适用于一种特定产品。这是代码:

     ***  /* Alternate code to change text for donation.
as per https://www.zen-cart.com/forum/showthread.php?t=115475
*/
// the alternate text - products_id would be the id of your donation product:
if ($_GET['products_id'] == 103){
$add_text = 'How much you want to donate: ';
$button_image = 'donate.png';
$button_alt = 'Donate';
} else {
$add_text = PRODUCTS_ORDER_QTY_TEXT;
$button_image = BUTTON_IMAGE_IN_CART;
$button_alt = BUTTON_IN_CART_ALT;
}
// show the quantity box -
// Everything is the same here, except at very beginning and at end:
$the_button = $add_text . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit($button_image, $button_alt);
}
$display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
?>
<?php if ($display_qty != '' or $display_button != '') { ?>
<div id="cartAdd">
<?php
echo $display_qty;
echo $display_button;
?>
</div>
<?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
***

我确信可以更改带有 productID 的这一行以获得类别。我只是不知道如何更改它。

if ($_GET['products_id'] == 103){ 

能请教一下吗?

最佳答案

if ($_GET['cPath'] == 29){

这应该会检索您的类别 ID 号。

关于php - 如何在 zencart for PHP 中获取类别 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32558576/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com