小编Joh*_*aly的帖子

Magento - 动态产品/动态定价/动态创建产品

我多次使用magento,但这是最终的挑战.我正在一家拥有400,000多种产品的magento商店工作 - 每种产品都有自己的变化/产品选择.我们的主商店每天都会添加和删除数百种产品(基于自定义购物车系统并在MSSQL上运行).

我已配置magento以获取所有类别,产品,文本,描述,价格,变化等,并动态创建产品页面,例如http://www.offices-furniture.co.uk/pp?prod=mercury-接收unit.html

问题是我现在需要能够将这些产品添加到购物车中,而不会将它们实际存在于后端.我已经在后端添加了一个产品并计划将其用作GENERAL模板类型产品,因此它总是将此产品(其变体)添加到购物车中,例如

http://www.offices-furniture.co.uk/frodo.php但我不能为我的生活得到改变的价格.... grrrr ..

如果有人能指出我正确的方向如何通过前端的HTML或PHP更改价格并将其发布到购物车而不改变后端的价格

在此先感谢所有...

这是我尝试用来改变价格的代码;

    <?php
require_once ("app/Mage.php");
umask(0);

Mage::app("default");

Mage::getSingleton("core/session", array("name" => "frontend"));

// get the current Magento cart
$cart = Mage::getSingleton('checkout/cart');
$product = Mage::getModel('catalog/product');
$product->setCustomPrice(99);
$product->setOriginalCustomPrice(99);
$product->getProduct()->setIsSuperMode(true);
$product->setTypeId('configurable');
$product->setTaxClassId(1); //none
$product->setSku(ereg_replace("\n","","videoTest2.2"));
$product->setName(ereg_replace("\n","","videoTest2.2"));
$product->setDescription("videoTest2.2");
$product->setPrice("129.95");
$product->setShortDescription(ereg_replace("\n","","videoTest2.2"));
$cart->save();

if(isset($_POST['submit'])){

// call the Magento catalog/product model

$product = Mage::getModel('catalog/product')
// set the current store ID
->setStoreId(Mage::app()->getStore()->getId())
// load the product object
->load($_POST['product']);
*/

////////////////////////////
// get the current Magento cart
$cart = Mage::getSingleton('checkout/cart'); …
Run Code Online (Sandbox Code Playgroud)

php magento

3
推荐指数
1
解决办法
4209
查看次数

标签 统计

magento ×1

php ×1