Значит, действия следующие:
Открываю файл shop.product_details.php и заменяю строки 294-324:
/* ADD-TO-CART */
$addtocart = "<div>
<form action=\"". $mm_action_url."index.php\" method=\"post\" name=\"addtocart\" id=\"addtocart\">"
.$ps_product_attribute->list_attribute($product_id)
// added for the advanced attribute modification
.$ps_product_attribute->list_advanced_attribute($product_id)
// end added for advanced attribute modification
.$ps_product_attribute->list_custom_attribute($product_id);
// end added for custom attribute modification
if (USE_AS_CATALOGUE != '1'
&& $product_price != ""
&& !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )
&& $auth['show_prices']) {
$quantity = mosGetParam( $_REQUEST, 'quantity', 1 );
$addtocart .= "
<p><label for=\"quantity\" style=\"vertical-align: middle;\">".$VM_LANG->_PHPSHOP_CART_QUANTITY.":</label>
<input type=\"text\" class=\"inputbox\" size=\"4\" id=\"quantity\" name=\"quantity\" value=\"$quantity\" style=\"vertical-align: middle;\" />
<input type=\"submit\" ";
$addtocart .= "style=\"text-align:center;background-position:bottom left;width:160px;height:35px;cursor:pointer;border:none;font-weight:bold;font-family:inherit;background: url('". IMAGEURL ."ps_image/".PSHOP_ADD_TO_CART_STYLE ."') no-repeat left center transparent;vertical-align: middle;\" ";
$addtocart .= "value=\"".$VM_LANG->_PHPSHOP_CART_ADD_TO ."\" title=\"".$VM_LANG->_PHPSHOP_CART_ADD_TO."\" />
</p>
<input type=\"hidden\" name=\"flypage\" value=\"shop.$flypage\" />
<input type=\"hidden\" name=\"page\" value=\"shop.cart\" />
<input type=\"hidden\" name=\"manufacturer_id\" value=\"$manufacturer_id\" />
<input type=\"hidden\" name=\"category_id\" value=\"$category_id\" />
<input type=\"hidden\" name=\"func\" value=\"cartAdd\" />
<input type=\"hidden\" name=\"option\" value=\"$option\" />
<input type=\"hidden\" name=\"Itemid\" value=\"$Itemid\" />";
}
$addtocart .= "</form>
</div>";
на это:
/*** Ajax Add-to-Cart Button ***/
if (USE_AS_CATALOGUE != '1' && $product_price != "" && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {
$form_addtocart = "<img id=\"img_".$db_browse->f("product_id")."\" src=\"".IMAGEURL."ps_image/add-to-cart1.gif\"
onClick=\"tocart(1,". $db_browse->f("product_id") .");return false;\" />\n";
} else
$form_addtocart = "";
Добавляю две строки из первого поста после defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );.
Открываю файл shop.browse.php и заменяю код со строчек 423-438:
/*** Add-to-Cart Button ***/
if (USE_AS_CATALOGUE != '1' && $product_price != "" && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {
$form_addtocart = "<form action=\"". $mm_action_url ."index.php\" method=\"post\" name=\"addtocart\" id=\"addtocart".$i."\">\n
<label for=\"quantity_".$i."\">".$VM_LANG->_PHPSHOP_CART_QUANTITY.":</label>\n
<input id=\"quantity_".$i."\" class=\"inputbox\" type=\"text\" size=\"3\" name=\"quantity\" value=\"1\" />
<input type=\"submit\" style=\"text-align:center;background-position:bottom left;width:160px;height:35px;cursor:pointer;border:none;font-weight:bold;font-family:inherit;background: url('". IMAGEURL ."ps_image/".PSHOP_ADD_TO_CART_STYLE ."') no-repeat left center transparent;vertical-align: middle;overflow:hidden;\" value=\"".$VM_LANG->_PHPSHOP_CART_ADD_TO ."\" title=\"".$VM_LANG->_PHPSHOP_CART_ADD_TO."\" />
<input type=\"hidden\" name=\"category_id\" value=\"". @intval($_REQUEST['category_id']) ."\" />\n
<input type=\"hidden\" name=\"product_id\" value=\"". $db_browse->f("product_id") ."\" />\n
<input type=\"hidden\" name=\"page\" value=\"shop.cart\" />\n
<input type=\"hidden\" name=\"func\" value=\"cartadd\" />\n
<input type=\"hidden\" name=\"Itemid\" value=\"$Itemid\" />\n
<input type=\"hidden\" name=\"option\" value=\"com_virtuemart\" />\n
</form>\n";
}
else
$form_addtocart = "";
на этот фрагмент:
/*** Ajax Add-to-Cart Button ***/
if (USE_AS_CATALOGUE != '1' && $product_price != "" && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {
$addtocart = "<img id=\"img_".$db_product->f("product_id")."\" src=\"".IMAGEURL."ps_image/add-to-cart1.gif\"
onClick=\"tocart(1,". $db_product->f("product_id") .");return false;\" />\n";
} else
$addtocart = "";
Повторяю добавление require("Sajax.php"); require("Sajax.knopa.php"); в хэдер.
Сами файлы залиты в html корень магазина.
Посмотри, может я удалил лишние строчки? (код привёл выше)
Файл shop.cart.php из архива топика накатить не могу, т.к. в моём файле уже присутствует модификация для сортировки по производителю.
На всякий случай прилагаю вариант shop.cart.php и shop.product_details.php, которые используются у меня на сайте (с сортировкой по производителю)
Буду премного благодарен, если поможешь добавить хак с Ajax корзиной в эти файлы.
ну или исходя из этого поста, подскажешь, где допущена ошибка.
[вложение удалено Администратором]