기본값은 괜찮지 않습니다. 기본값> 영어가 완벽합니다.
-
29-09-2020 - |
문제
우리는 마켓 플레이스 멀티 벤더 / 판매자 사이트를 보유하고 있습니다. 우리는 판매자가 프론트 엔드를 통해 제품 정보를 업데이트하는 옵션을 제공했습니다.
"Cod" is Attribute Label and "cod_available" is attribute code
.
COD 속성은 특정 상점보기에만 업데이트됩니다
우리가 상점을 통해 업데이트 할 때, 그것의 일하고 있습니다.
" 기본값 "를 통해 업데이트 할 때
가 작동하지 않습니다.이미지에서 다음을 볼 수 있습니다. 기본값> 영어
해당 작업을 선택하고 속성 값을 갱신하고 속성 값을 업데이트하십시오. 그러나
"기본값"을 선택하지 않고 "기본값"을 선택하면
이 문제에 직면 해있는 드롭 다운 속성입니다. 그러나 "TextField"속성의 모든 것이 잘 작동합니다.
우리는 다음 코드를 사용하고 있습니다 :
cod
for phtml 코드<td>
<?php $attribute = $products->getResource()->getAttribute('cod_available');?>
<?php if($attribute):?>
<?php $attribute_value = $attribute ->getFrontend()->getValue($products); ?>
<select id = "cod_<?php echo $products->getId(); ?>" name= "cod[]" >
<option value="0" <?php if($pro->getCodAvailable()==0) { echo "selected";} ?>>No</option>
<option value="1"<?php if($pro->getCodAvailable()==1) { echo "selected";} ?>>Yes</option>
</select>
<?php endif; ?>
<input type="hidden" name="codcurr_<?php echo $products->getId(); ?>" id="codcurr_<?php echo $products->getId(); ?>" value="<?php echo $products->getCod(); ?>" />
<p id="updatedcod_<?php echo $products->getId(); ?>" style = "display:none;color:red; position:relative; top:16px;">Updated</p>
<br/>
<button id="cod_reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideResetCod('<?php echo $products->getId(); ?>','<?php echo $products->getPrice(); ?>'); return false;">
<span><span><?php echo $helper->__('Cancel') ?></span></span>
</button>
</span>
</td>
.
모든 제품의 PHTML 코드
<td>
<button id="update_button_<?php echo $products->getId(); ?>" class="button wk_mp_btn1" onclick="updateAllFields('<?php echo $products->getId(); ?>'); return false;" type="button" >
<span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
</button>
</td>
.
에 대한 스크립트
function hideResetCod(product_id,codold) {
var qtyId='#cod_'+ product_id;
var currcod='#codcurr_'+ product_id;
var editLink="#cod_edit_link_"+ product_id;
var updateButton="#cod_update_button_"+ product_id;
var valuecod="#valuecod_"+ product_id;
var resetButton="#cod_reset_button_"+ product_id;
$wk_jq(valuecod).show();
$wk_jq(qtyId).val( $wk_jq(currcod).val());
$wk_jq(editLink).show();
}
function updateFieldCod(product_id)
{
var codId = '#cod_'+ product_id;
var currcod='#codcurr_'+ product_id;
var updatedqty = '#updatedcod_'+ product_id;
var url ='<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateFieldCod/')?>';
$cod = $wk_jq(codId).val();
$currcod = $wk_jq(codId).val();
if($cod!=$currcod) {
$wk_jq(currcod).val($cod);
new Ajax.Request(url, {
method: 'post',
parameters: {id: product_id, cod: $cod},
//parameters: {id: product_id, cod: $cod},
onComplete: function (transport) {
//alert(transport.responseText);
jQuery(updatedqty).show().delay(2000).fadeOut();
}
});
}
}
.
모든 제품 인프로테이션
업데이트하는 스크립트function updateAllFields(product_id) {
jQuery('#price_reset_button_'+product_id).css('display','none');
if(jQuery("#price_"+product_id).val() != jQuery("#curr_"+product_id).val())
updateFieldPrice(product_id);
if(jQuery("#specialprice_"+product_id).val() != jQuery("#specialcurr_"+product_id).val())
updateFieldSpecialPrice(product_id);
updateField(product_id);
if(jQuery("#cod_"+product_id).val() != jQuery("#codcurr_"+product_id).val())
updateFieldCod(product_id);
updateField(product_id);
}
.
code
에 대한 Controller.phppublic function updateFieldCodAction(){
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$id= $this->getRequest()->getParam('id');
$customerid=Mage::getSingleton('customer/session')->getCustomerId();
$collection_product = Mage::getModel('marketplace/product')->getCollection()->addFieldToFilter('mageproductid',array('eq'=>$id))->addFieldToFilter('userid',array('eq'=>$customerid));
try{
$upd_cod = $this->getRequest()->getParam('cod');
$product = Mage::getModel('catalog/product')->load($id);
$product->setData('cod_available',$upd_cod);
$product->getResource()->saveAttribute($product,'cod_available');
// $product->setCod($upd_cod);
$product->save();
echo $cod = $product->getCod();
echo $name = $product->getName();
$response['message'] = 'Your Product Is Been Sucessfully Updated';
$this->getResponse()->setBody(Mage::helper('core')->jsonEncode($response));
}catch(Exception $e){
echo "Not Saving"; exit;
Mage::log($e->getMessage());
}
}
.
Controller.php 모든 제품 정보
public function massupdatesellerproAction(){
if($this->getRequest()->isPost()){
if(!$this->_validateFormKey()){
$this->_redirect('marketplace/marketplaceaccount/myproductslist/');
}
$ids= $this->getRequest()->getParam('product_mass_update');
$price= $this->getRequest()->getParam('price');
$special= $this->getRequest()->getParam('specialprice');
$cod= $this->getRequest()->getParam('cod');
foreach ($ids as $key => $value) {
$product = Mage::getModel('catalog/product')->load($value);
$product->setPrice($price[$key]);
$product->setSpecialPrice($special[$key]);
$product->setQty($qty[$key]);
$product->setCodAvailable($cod[$key]);
$product->save();
}
Mage::getSingleton('core/session')->addSuccess( Mage::helper('marketplace')->__('Products has been sucessfully deleted from your account'));
$this->_redirect('marketplace/marketplaceaccount/myproductslist/');
}}
. 해결책
function hideResetCod(product_id,codold) {
var qtyId='#cod_'+ product_id;
var currcod='#codcurr_'+ product_id;
var editLink="#cod_edit_link_"+ product_id;
var updateButton="#cod_update_button_"+ product_id;
var valuecod="#valuecod_"+ product_id;
var resetButton="#cod_reset_button_"+ product_id;
$wk_jq(valuecod).show();
$wk_jq(qtyId).val( $wk_jq(currcod).val());
$wk_jq(editLink).show();
}
function updateFieldCod(product_id)
{
var codId = '#cod_'+ product_id;
var currcod='#codcurr_'+ product_id;
var updatedqty = '#updatedcod_'+ product_id;
var url ='<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateFieldCod/')?>';
$cod = $wk_jq(codId).val();
$currcod = $wk_jq(codId).val();
if($cod!=$currcod) {
$wk_jq(currcod).val($cod);
new Ajax.Request(url, {
method: 'post',
parameters: {id: product_id, cod: $cod},
//parameters: {id: product_id, cod: $cod},
onComplete: function (transport) {
//alert(transport.responseText);
jQuery(updatedqty).show().delay(2000).fadeOut();
}
});
}
}
. 제휴하지 않습니다 magento.stackexchange