我想从产品目录页面重定向到产品详细信息页面,而不是将产品添加到购物车。
这是代码的片段。
public static function getListing($_product, $productObj, $isgrid, $isa = false)
{
$_typeId = self::getAttributeCodeForId($_product->getId(), 'type_id');
$_isReservation = self::getAttributeCodeForId($_product->getId(), 'is_reservation');
if (!self::useListButtons() || !(ITwebexperts_Payperrentals_Helper_Data::isReservationType($_product))) {
$buttonsArr = array();
if (ITwebexperts_Payperrentals_Helper_Data::isReservationType($_product)) {
if ($_isReservation == ITwebexperts_Payperrentals_Model_Product_Isreservation::STATUS_RENTAL && $_typeId != ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_GROUPED) {
$addToCartTitle = Mage::helper('payperrentals')->__('Add to Queue');
} elseif ($_isReservation == ITwebexperts_Payperrentals_Model_Product_Isreservation::STATUS_RENTAL && $_typeId == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_GROUPED) {
$addToCartTitle = Mage::helper('payperrentals')->__('Add All To Queue');
//check if at least one is simple and add the button addtocart
$childrensArr = $_product->getTypeInstance(true)->getAssociatedProducts($_product);
$p = 0;
$c = 0;
foreach ($childrensArr as $iChild) {
if ($iChild->getTypeId() == 'simple') { // or configurable and isReservation=disabled or bundle and isreservation=disabled
if ($c == 0) {
$buttonsArr[] = '<p><button type="button" title="' . Mage::helper('payperrentals')->__('Add to Cart') . '" class="button btn-cart" onclick="setLocation(\'' . Mage::helper('payperrentals')->getAddToCartUrl($iChild) . '\')"><span><span>' . Mage::helper('payperrentals')->__('Add to Cart') . '</span></span></button></p>';
}
$c++;
} elseif ($iChild->getIsReservation() == ITwebexperts_Payperrentals_Model_Product_Isreservation::STATUS_RENTAL) {
$p++;
}
}
if ($p == 1) {
$addToCartTitle = Mage::helper('payperrentals')->__('Add to Queue');
}
if ($c > 1) {
$buttonsArr = array();
}
} else {
$addToCartTitle = Mage::helper('payperrentals')->__('Rent Now');
}
} else {
$addToCartTitle = Mage::helper('payperrentals')->__('Add To Cart');
}
$retBut = '';
if ($_isReservation == ITwebexperts_Payperrentals_Model_Product_Isreservation::STATUS_RENTALANDRESERVATION) {
$retBut .= ($isgrid ? '<div class="actions-btn">' : '<p class="actions-btn">') . '<button type="button" title="' . Mage::helper('payperrentals')->__('Add to Queue') . '" class="button btn-cart1" onclick="setLocation(\'' . Mage::helper('checkout/cart')->getAddUrl($_product, array('_query' => array('options' => array('one_option' => 'no_value'), 'is_reservation' => ITwebexperts_Payperrentals_Model_Product_Isreservation::STATUS_RENTAL))) . '\')"><span><span>' . Mage::helper('payperrentals')->__('Add to Queue') . '</span></span></button>
<button id="product-id-' . $_product->getId() . '" type="button" title="' . $addToCartTitle . '" class="button btn-cart" onclick="setLocation(\'' . $productObj->getAddToCartUrl($_product) . '\')"><span><span>' . Mage::helper('payperrentals')->__('Rent') . '</span></span></button>' . ($isgrid ? '</div>' : '</p>');
} elseif ($_isReservation == ITwebexperts_Payperrentals_Model_Product_Isreservation::STATUS_RENTAL) {
$retBut .= ($isgrid ? '<div class="actions-btn">' : '<p class="actions-btn">') . '<button type="button" title="' . $addToCartTitle . '" class="button btn-cart1" onclick="setLocation(\'' . Mage::helper('checkout/cart')->getAddUrl($_product, array('_query' => array('options' => array('one_option' => 'no_value'), 'is_reservation' => ITwebexperts_Payperrentals_Model_Product_Isreservation::STATUS_RENTAL))) . '\')"><span><span>' . $addToCartTitle . '</span></span></button>' . ($isgrid ? '</div>' : '</p>');
} else {
if (!$isa) {
$retBut .= ($isgrid ? '<div class="actions-btn">' : '<p class="actions-btn">') . '<button id="product-id-' . $_product->getId() . '" type="button" title="' . $addToCartTitle . '" class="button btn-cart" onclick="setLocation(\'' . $productObj->getAddToCartUrl($_product) . '\')"><span><span>' . $addToCartTitle . '</span></span></button>' . ($isgrid ? '</div>' : '</p>');
} else {
$retBut .= '<a id="product-id-' . $_product->getId() . '" title="' . $addToCartTitle . '" class="btn-cart" href="' . $productObj->getAddToCartUrl($_product) . '">' . $addToCartTitle . '</a>';
}
}
foreach ($buttonsArr as $but) {
if (!$isa) {
$retBut .= ($isgrid ? '</div>' : '') . $but . ($isgrid ? '</div>' : '');
}
}
$price = $productObj->getPriceHtml($_product, true);
if ($isgrid) {
if (count($buttonsArr) == 0) {
$action = '<div class="actions">';
} else {
$action = '<div class="actions1"><style> .products-grid .actions1 { position:absolute; bottom:3px; } .products-grid .actions1 button{ margin-top:2px; } </style>';
}
} else {
$action = '';
}
return array(
'buttons' => $retBut,
'pricing' => $price,
'action' => $action
);
} else {
if ($isgrid) {
$action = '<div class="actions">';
} else {
$action = '';
}
$price = $productObj->getPriceHtml($_product, true);
return array(
'buttons' => '',
'pricing' => $price,
'action' => $action
);
//get the defined periods for the product
//check if product is available for that period? using the startDateinitial
//modify view.phtml to use the rent buttons
}
}
所以任何人都可以告诉我在重定向到产品详细信息页面时需要做哪些更改以及需要做些哪些更改