Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $isPartner= Mage::getModel('marketplace/userprofile')->isPartner();
- $helper= Mage::helper('marketplace');
- if($isPartner==1){
- ?>
- <script type="text/javascript">
- if (typeof jQuery == 'undefined'){
- document.write(unescape("%3Cscript src='//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
- }
- </script>
- <script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
- <link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
- <div class="page-title">
- <h1 style="float:left;"><?php echo $helper->__('My Product List') ?></h1>
- </div>
- <div class="wk_mp_design">
- <div class="block block-account">
- <div class="block-title">
- <strong><span><h4><?php echo $helper->__('Product List') ?></h4></span></strong>
- </div>
- </div>
- <div class="fieldset wk_mp_fieldset">
- <div class="grid">
- <div class="hor-scroll">
- <form action="<?php echo Mage::helper('core/url')->getCurrentUrl();?>" method="post">
- <table cellspacing="0" class="border wk_mp_list_table">
- <thead>
- <tr id="wk_mp_tr_heading">
- <th><span><?php echo $helper->__('Product Name') ?></span></th>
- <th><span><?php echo $helper->__('Date') ?></span></th>
- <th><span><?php echo $helper->__('Product Status') ?></span></th>
- <th><span> </span></th>
- </tr>
- </thead>
- <tbody class="wk_mp_body">
- <tr>
- <td>
- <input type="text" class="input-text" name="s" placeholder='<?php echo $helper->__('Search by product name') ?>' value="<?php echo $this->getRequest()->getParam('s')?>"/>
- </td>
- <td>
- <span class="wk_mp_td_span">
- <?php echo $helper->__('From: ') ?>
- <input name="from_date" id="special_from_date" class="input-text" value="<?php echo $this->getRequest()->getParam('from_date')?>" />
- </span>
- <span class="wk_mp_td_span">
- <?php echo $helper->__('To: ') ?>
- <input name="to_date" id="special_to_date" class="input-text" value="<?php echo $this->getRequest()->getParam('to_date')?>" />
- </span>
- </td>
- <td>
- <select name="prostatus" class="input-text">
- <option value=""><?php echo $helper->__('All') ?></option>
- <option value="1" <?php if($this->getRequest()->getParam('prostatus') == 1) echo 'selected="selected"'?>>
- <?php echo $helper->__('Approved') ?>
- </option>
- <option value="2" <?php if($this->getRequest()->getParam('prostatus') == 2) echo 'selected="selected"'?>>
- <?php echo $helper->__('Unapproved') ?>
- </option>
- </select>
- </td>
- <td>
- <button class="button" title="Save" type="submit">
- <span><span><span><?php echo $helper->__('Submit') ?></span></span></span>
- </button>
- </td>
- </tr>
- </tbody>
- </table>
- </form>
- <?php
- if(count($this->getCollection())==0){ ?>
- <div class="fieldset wk_mp_fieldset">
- <div class="wk_emptymsg">
- <?php echo $helper->__('No Product Available') ?>
- </div>
- </div>
- <?php
- } else{ ?>
- <form action="<?php echo $this->getUrl('marketplace/marketplaceaccount/massdeletesellerpro') ?>" method="post" id="formmassdelete" name="formmassdelete">
- <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
- <button class="button" title="<?php echo $helper->__('Delete Products') ?>" type="submit" style="float: left;padding: 5px 5px 5px 0;" id="mass_delete_butn">
- <span><span><?php echo $helper->__('Delete Products') ?></span></span>
- </button>
- <table cellspacing="0" class="border wk_mp_list_table wk_mp_list_container_table">
- <thead>
- <tr class="wk_content">
- <th class="wk_check_first_td">
- <span>
- <input type="checkbox" name="mpselecctall" value="all" id="mpselecctall"/>
- </span>
- </th>
- <th class="wk_first_td">
- <span class="label name">
- <?php echo $helper->__('Product')?>
- </span>
- </th>
- <th>
- <span class="label">
- <?php echo $helper->__('sku')?>
- </span>
- </th>
- <!-- status
- <th>
- <span class="label pro_status">
- <?php echo $helper->__('Status')?>
- </span>
- </th>
- -->
- <th>
- <span class="label">
- <?php echo $helper->__('Price')?>
- </span>
- </th>
- <th>
- <span class="label">
- <?php echo $helper->__('Special Price')?>
- </span>
- </th>
- <!--
- <th>
- <span class="label qty">
- <?php echo $helper->__('Qty. Confirmed')?>
- </span>
- </th>
- <th>
- <span class="label qty">
- <?php echo $helper->__('Qty. Pending')?>
- </span>
- </th>
- <th>
- <span class="label qty">
- <?php echo $helper->__('Qty. Sold')?>
- </span>
- </th>
- -->
- <th>
- <span class="label">
- <?php echo $helper->__('Qty')?>
- </span>
- </th>
- <th>
- <span class="label">
- <?php echo $helper->__('Earn Amount')?>
- </span>
- </th>
- <th>
- <span class="label">
- <?php echo $helper->__('Action')?>
- </span>
- </th>
- </tr>
- </thead>
- <tbody>
- <?php
- $i = 0;
- foreach($this->getCollection() as $products){
- $i++;
- $productMediaConfig = Mage::getModel('catalog/product_media_config');
- $salesdetail=Mage::getModel('marketplace/saleslist')->getSalesdetail($products->getEntityId());
- ?>
- <tr class="wk_row_view <?php echo $class = ($i == count($this->getCollection()))? 'wk_last_tr':''?>">
- <td class="wk_check_first_td">
- <span>
- <input type="checkbox" name="product_mass_delete[]" class="mpcheckbox" value="<?php echo $products->getEntityId(); ?>"/>
- </span>
- </td>
- <td class="wk_first_td">
- <input type="hidden" class="hidden_id" value="<?php echo $products->getEntityId(); ?>" />
- <div class="label name" title="<?php echo $products->getName(); ?>">
- <div class="wk_pro_divide1">
- <img src="<?php echo Mage::helper('catalog/image')->init($products,'thumbnail');?>" class="image" />
- </div>
- <div class="wk_pro_divide2">
- <div style="width:100%;">
- <a href="<?php echo $this->getUrl($products->getUrlPath())?>" target="blank">
- <?php echo $products->getName();?>
- </a>
- </div>
- </div>
- </div>
- </td>
- <td>
- <?php echo $sku = Mage::getModel('catalog/product')->load($products->getId())->getSku();?>
- </td>
- <?php
- if($products->getStatus()==2) { ?>
- <td>
- <span class="label pro_status">
- <?php echo $helper->__('Pending')?>
- </span>
- </td>
- <td>
- <span class="label qty">
- <?php echo $helper->__('Pending')?>
- </span>
- </td>
- <td>
- <span class="label qty">
- <?php echo $helper->__('Pending')?>
- </span>
- </td>
- <td>
- <span class="label qty">
- <?php echo $helper->__('Pending')?>
- </span>
- </td>
- <td>
- <span class="label qty">
- <?php echo $helper->__('Pending')?>
- </span>
- </td>
- <?php }
- else{
- $id=$products->getId();
- $productsolddetail=Mage::getModel('marketplace/saleslist')->getProductSalesDetailById($id);
- $qtycom=0;
- $com=0;
- foreach($productsolddetail as $key){
- $qtycom+=$key['magequantity'];
- $com+=$key['actualparterprocost'];
- } ?>
- <!-- Status
- <td>
- <span class="label pro_status">
- <?php echo $helper->__('Approved')?>
- </span>
- </td>
- -->
- <!-- Price start -->
- <td>
- <span class="label pro_status">
- <?php //echo $products->getPrice(); ?>
- <span id="valueprice_<?php echo $products->getId(); ?>"><?php echo $products->getPrice(); ?></span>
- <input type = "text" id = "price_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" "name = "price" value = "<?php echo $products->getPrice(); ?>" style = "display:none"/>
- <span class="label wk_action" id="edit_link_<?php echo $products->getId(); ?>">
- <img onclick="showFieldPrice('<?php echo $products->getId(); ?>'); return false;" src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
- </span>
- <p id="updatedprice_<?php echo $products->getId(); ?>" style = "display:none;color:red;">Updated</p>
- <br/>
- <button id="price_update_button_<?php echo $products->getId(); ?>" class="button wk_mp_btn1" onclick="updateFieldPrice('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
- <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
- </button>
- <button id="price_reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideResetPrice('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
- <span><span><?php echo $helper->__('Cancel') ?></span></span>
- </button>
- </span>
- </td>
- <!-- price end -->
- <!-- SP start -->
- <td>
- <span class="label pro_status">
- <?php //echo $products->getPrice(); ?>
- <span id="valueprice_<?php echo $products->getId(); ?>"><?php echo $products->getSpecialPrice(); ?></span>
- <input type = "text" id = "specialprice_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" "name = "price" value = "<?php echo $products->getSpecialPrice(); ?>" style = "display:none"/>
- <span class="label wk_action" id="edit_link_<?php echo $products->getId(); ?>">
- <img onclick="showFieldSpecialPrice('<?php echo $products->getId(); ?>'); return false;" src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
- </span>
- <p id="updatedspecialprice_<?php echo $products->getId(); ?>" style = "display:none;color:red;">Updated</p>
- <br/>
- <button id="specialprice_update_button_<?php echo $products->getId(); ?>" class="button wk_mp_btn1" onclick="updateFieldSpecialPrice('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
- <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
- </button>
- <button id="specialprice_reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideResetSpecialPrice('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
- <span><span><?php echo $helper->__('Cancel') ?></span></span>
- </button>
- </span>
- </td>
- <!-- SP end-->
- <!-- qty start -->
- <td>
- <span id="valueqty_<?php echo $products->getId(); ?>"><?php echo (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($products)->getQty(); ?></span>
- <input type = "text" id = "qty_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" "name = "stock" value = "<?php echo (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($products)->getQty(); ?>" style = "display:none"/>
- <span class="label wk_action" id="edit_link_<?php echo $products->getId(); ?>">
- <img onclick="showField('<?php echo $products->getId(); ?>'); return false;" src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
- </span>
- <p id="updatedqty_<?php echo $products->getId(); ?>" style = "display:none;color:red;">Updated</p>
- <br/>
- <button id="update_button_<?php echo $products->getId(); ?>" class="button wk_mp_btn1" onclick="updateField('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
- <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
- </button>
- <button id="reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideReset('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
- <span><span><?php echo $helper->__('Cancel') ?></span></span>
- </button>
- <!-- edit qty end 2 -->
- <!--
- <td>
- <span class="label qty">
- <?php echo $salesdetail['quantitysoldconfirmed']; ?>
- </span>
- </td>
- <td>
- <span class="label qty">
- <?php echo $salesdetail['quantitysoldpending']; ?>
- </span>
- </td>
- <td>
- <span class="label qty">
- <a href="<?php echo $this->getUrl('mpshippingmanager/shipping/salesdetail/')."id/".$products->getId(); ?>"><?php echo $salesdetail['quantitysold']; ?></a>
- </span>
- </td>
- -->
- <td>
- <span class="label price">
- <?php echo Mage::helper('core')->currency($salesdetail['amountearned'], true, false); ?>
- </span>
- </td>
- <td>
- <button id="update_button_<?php echo $products->getId(); ?>" class="button wk_mp_btn1" onclick="updateAllFields('<?php echo $products->getId(); ?>'); return false;" >
- <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
- </button>
- </td>
- <?php
- }?>
- <td>
- <span class="label wk_action">
- <img src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>" data-type="<?php echo $products->getTypeId(); ?>" alt="<?php echo $helper->__('Edit')?>" title="<?php echo $helper->__('Edit')?>" class="mp_edit"/>
- <img src="<?php echo $this->getSkinUrl('marketplace/images/icon-trash.png'); ?>" alt="<?php echo $helper->__('Delete')?>" title="<?php echo $helper->__('Delete')?>" class="mp_delete"/>
- </span>
- </td>
- </tr>
- <?php
- }?>
- </tbody>
- </table>
- </form>
- <?php
- }?>
- </div>
- </div>
- <?php echo $this->getPagerHtml(); ?>
- </div>
- <div class="buttons-set">
- <p class="back-link">
- <a href="javascript:;" onclick="javascript: window.history.back();" class="left">« <?php echo $helper->__('Back') ?></a>
- </p>
- </div>
- </div>
- <!-- edit qty start 2-->
- <?php $url = Mage::getUrl('module_name/index/updateField/'); ?>
- <?php $url = Mage::getUrl('marketplaceaccountcontroller/index/updateField/'); ?>
- <!-- aki 2 -->
- <script type = "text/javascript" >
- function validateNumbers(e) {
- //var key = '#keyinput_'+ product_id;
- //var e = jQuery(key);
- if (jQuery.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
- // Allow: Ctrl+A, Command+A
- (e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) ||
- // Allow: home, end, left, right, down, up
- (e.keyCode >= 35 && e.keyCode <= 40)) {
- // let it happen, don't do anything
- return;
- }
- // Ensure that it is a number and stop the keypress
- if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
- e.preventDefault();
- }
- }
- var $wk_jq = jQuery.noConflict();
- function hideReset(product_id) {
- var qtyId='#qty_'+ product_id;
- var editLink="#edit_link_"+ product_id;
- var updateButton="#update_button_"+ product_id;
- var resetButton="#reset_button_"+ product_id;
- $wk_jq(qtyId).hide();
- $wk_jq(editLink).show();
- $wk_jq(updateButton).hide();
- $wk_jq(resetButton).hide();
- }
- function hideResetPrice(product_id) {
- var qtyId='#price_'+ product_id;
- var editLink="#price_edit_link_"+ product_id;
- var updateButton="#price_update_button_"+ product_id;
- var resetButton="#price_reset_button_"+ product_id;
- $wk_jq(qtyId).hide();
- $wk_jq(editLink).show();
- $wk_jq(updateButton).hide();
- $wk_jq(resetButton).hide();
- }
- <!-- code for special price -->
- function hideResetSpecialPrice(product_id) {
- var qtyId='#specialprice_'+ product_id;
- var editLink="#specialprice_edit_link_"+ product_id;
- var updateButton="#specialprice_update_button_"+ product_id;
- var resetButton="#specialprice_reset_button_"+ product_id;
- $wk_jq(qtyId).hide();
- $wk_jq(editLink).show();
- $wk_jq(updateButton).hide();
- $wk_jq(resetButton).hide();
- }
- <!-- code for special price end -->
- function showField(product_id)
- {
- var qtyId='#qty_'+ product_id;
- var editLink="#edit_link_"+ product_id;
- var updateButton="#update_button_"+ product_id;
- var resetButton="#reset_button_"+ product_id;
- $wk_jq(qtyId).show();
- $wk_jq(editLink).hide();
- $wk_jq(updateButton).show();
- $wk_jq(updateButton).prop('disabled', false);//just in case
- $wk_jq(resetButton).show();
- return false;
- }
- function showFieldPrice(product_id)
- {
- var qtyId='#price_'+ product_id;
- var editLink="#price_edit_link_"+ product_id;
- var updateButton="#price_update_button_"+ product_id;
- var resetButton="#price_reset_button_"+ product_id;
- $wk_jq(qtyId).show();
- $wk_jq(editLink).hide();
- $wk_jq(updateButton).show();
- $wk_jq(updateButton).prop('disabled', false);//just in case
- $wk_jq(resetButton).show();
- return false;
- }
- <!-- sp start -->
- function showFieldSpecialPrice(product_id)
- {
- var qtyId='#specialprice_'+ product_id;
- var editLink="#specialprice_edit_link_"+ product_id;
- var updateButton="#specialprice_update_button_"+ product_id;
- var resetButton="#specialprice_reset_button_"+ product_id;
- $wk_jq(qtyId).show();
- $wk_jq(editLink).hide();
- $wk_jq(updateButton).show();
- $wk_jq(updateButton).prop('disabled', false);//just in case
- $wk_jq(resetButton).show();
- return false;
- }
- <!-- sp end -->
- function updateField(product_id)
- {
- var qtyId = '#qty_'+ product_id;
- var valueId = '#valueqty_'+ product_id;
- var updatedqty = '#updatedqty_'+ product_id;
- var editLink = "#edit_link_"+ product_id;
- var updateButton = "#update_button_"+ product_id;
- var resetButton = "#reset_button"+ product_id;
- var url ='<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateField/')?>';
- $wk_jq(qtyId).toggle()
- $wk_jq(editLink).hide();
- $wk_jq(updateButton).show();
- $wk_jq(resetButton).show();
- $qty = $wk_jq(qtyId).val();
- jQuery(valueId).html($qty);
- hideReset(product_id);
- new Ajax.Request(url, {
- method: 'post',
- parameters: {id: product_id, qty: $qty},
- onComplete: function (transport) {
- //alert(transport.responseText);
- jQuery(updatedqty).show().delay(2000).fadeOut();
- $updateButton.prop('disabled', false);
- $wk_jq(qtyId).setValue($qty);
- }
- });
- }
- function updateFieldPrice(product_id)
- {
- var priceId = '#price_'+ product_id;
- var valueId = '#valueprice_'+ product_id;
- var updatedqty = '#updatedprice_'+ product_id;
- var editLink = "#price_edit_link_"+ product_id;
- var updateButton = "#price_update_button_"+ product_id;
- var resetButton = "#price_reset_button_"+ product_id;
- var url ='<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateFieldPrice/')?>';
- $wk_jq(priceId).toggle()
- $wk_jq(editLink).hide();
- $wk_jq(updateButton).hide();
- $wk_jq(resetButton).hide();
- $price = $wk_jq(priceId).val();
- jQuery(valueId).html($price);
- hideReset(product_id);
- new Ajax.Request(url, {
- method: 'post',
- parameters: {id: product_id, price: $price},
- onComplete: function (transport) {
- //alert(transport.responseText);
- jQuery(updatedqty).show().delay(2000).fadeOut();
- $updateButton.prop('disabled', false);
- $wk_jq(priceId).setValue($price);
- }
- });
- }
- <!-- js code for SP start -->
- function updateFieldSpecialPrice(product_id)
- {
- var priceId = '#specialprice_'+ product_id;
- var valueId = '#valuespecialprice_'+ product_id;
- var updatedqty = '#updatedspecialprice_'+ product_id;
- var editLink = "#specialprice_edit_link_"+ product_id;
- var updateButton = "#specialprice_update_button_"+ product_id;
- var resetButton = "#specialprice_reset_button_"+ product_id;
- var url ='<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateFieldSpecialPrice/')?>';
- $wk_jq(priceId).toggle()
- $wk_jq(editLink).hide();
- $wk_jq(updateButton).hide();
- $wk_jq(resetButton).hide();
- $price = $wk_jq(priceId).val();
- jQuery(valueId).html($price);
- hideReset(product_id);
- new Ajax.Request(url, {
- method: 'post',
- parameters: {id: product_id, price: $price},
- onComplete: function (transport) {
- //alert(transport.responseText);
- jQuery(updatedqty).show().delay(2000).fadeOut();
- $updateButton.prop('disabled', false);
- $wk_jq(priceId).setValue($price);
- }
- });
- }
- <!-- js code for SP end -->
- function updateAllFields(product_id) {
- updateFieldPrice(product_id);
- updateFieldSpecialPrice(product_id);
- updateField(product_id);
- }
- </script>
- <script>
- var $wk_jq=jQuery.noConflict();
- var newCustomerProductForm1 = new VarienForm('formmassdelete', true);
- (function($wk_jq){
- $wk_jq( "#special_from_date" ).datepicker({dateFormat: "yy-mm-dd"});
- $wk_jq( "#special_to_date" ).datepicker({dateFormat: "yy-mm-dd"});
- $wk_jq('body').delegate('.mp_edit','click',function(){
- var id=$wk_jq(this).parents('.wk_row_view').find('.hidden_id').val();
- var dicision=confirm('<?php echo $helper->__(" Are you sure you want to edit this product ? ")?>');
- if(dicision==true){
- var $type_id=$wk_jq(this).attr('data-type');
- if($type_id=='simple')
- window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/editapprovedsimple/') ?>".concat("id/",id);
- if($type_id=='downloadable')
- window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/editapproveddownloadable/') ?>".concat("id/",id);
- if($type_id=='virtual')
- window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/editapprovedvirtual/') ?>".concat("id/",id);
- if($type_id=='configurable')
- window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/editapprovedconfigurable/') ?>".concat("id/",id);
- if($type_id=='grouped')
- window.location = "<?php echo $this->getUrl('mpgroupproduct/index/editapprovedgrouped/') ?>".concat("id/",id);
- <?php
- //echo $this->getChildHtml('mpgrouped_productslist');
- // echo $this->getChildHtml('mpbundle_productslist');
- ?>
- if($type_id=='bundle')
- window.location = "<?php echo $this->getUrl('mpbundleproduct/index/editbundle/') ?>".concat("id/",id);
- }
- });
- $wk_jq('#mass_delete_butn').click(function(e){
- var flag =0;
- $wk_jq('.mpcheckbox').each(function(){
- if (this.checked == true){
- flag =1;
- }
- });
- if (flag == 0){
- alert("<?php echo $helper->__(' No Checkbox is checked ') ?>");
- return false;
- }
- else{
- var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete these product ? ")?>');
- if(dicisionapp==true){
- $wk_jq('#form-customer-product-new').submit();
- }else{
- return false;
- }
- }
- });
- $wk_jq('#mpselecctall').click(function(event) {
- if(this.checked) {
- $wk_jq('.mpcheckbox').each(function() {
- this.checked = true;
- });
- }else{
- $wk_jq('.mpcheckbox').each(function() {
- this.checked = false;
- });
- }
- });
- $wk_jq('.mp_delete').click(function(){
- var id=$wk_jq(this).parents('.wk_row_view').find('.hidden_id').val();
- var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete this product ? ")?>');
- if(dicisionapp==true)
- window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/delete/') ?>".concat("id/",id);
- });
- })($wk_jq);
- </script>
- <script>
- var $wk_jq=jQuery.noConflict();
- var i=2;
- function showOtherImage(){
- var newdiv = document.createElement('div');
- newdiv.setAttribute("id","childDiv"+i);
- newdiv.innerHTML = "<input type='file' name='images"+i+"' accept='image/\*' class='wk_imagevalidate'/><input type='radio' onClick='defaultimagevalue(this)' value='' class='defaultimage' name='defaultimage'><span class='defaultimageset'>Base image</span><a href=\"javascript:;\" onclick=\"removeEvent('childDiv"+i+"')\"><?php echo $helper->__('Remove ') ?></a>";
- var ni = document.getElementById('otherimages');
- ni.appendChild(newdiv);
- i++;
- }
- function removeEvent(divNum){
- var d = document.getElementById('otherimages');
- var olddiv = document.getElementById(divNum);
- d.removeChild(olddiv);
- i--;
- }
- function defaultimagevalue(object){
- var strs=$wk_jq(object).prev('input').val().split('\\');
- $wk_jq(object).val(strs[strs.length-1]);
- }
- (function($wk_jq){
- var newCustomerProductForm = new VarienForm('form-customer-product-editPost', true);
- $wk_jq( "#special_from_date" ).datepicker({'dateFormat':'yy:mm:dd'});
- $wk_jq( "#special_to_date" ).datepicker({'dateFormat':'yy:mm:dd'});
- $wk_jq('.wk_close').click(function(){
- $wk_jq(this).parent().remove();
- });
- $wk_jq('#save_butn').click(function(e){
- if(newCustomerProductForm.validator.validate()!=false){
- var descrip = nicEditors.findEditor( "description" ).getContent();
- var sdescrip = nicEditors.findEditor( "short_description" ).getContent();
- //var regex = /(<([^>]+)>)/ig;
- var regex = /<script(.+?)<\/script>/g;
- var result = descrip .replace(regex, "");
- result = result.replace(/script/g,'');
- nicEditors.findEditor( "description" ).setContent(result);
- var sresult = sdescrip .replace(regex, "");
- sresult = sresult.replace(/script/g,'');
- nicEditors.findEditor( "short_description" ).setContent(sresult);
- $wk_jq('#description').text(result);
- $wk_jq('#short_description').text(sresult);
- $wk_jq('#save_butn span span').text('<?php echo $helper->__(" Saving..")?>');
- $wk_jq('.button').css('opacity','0.7');
- $wk_jq('.button').css('cursor','default');
- $wk_jq('.button').attr('disabled','disabled');
- $wk_jq('#form-customer-product-editPost').submit();
- }
- });
- $wk_jq('.input-text').change(function(){
- var validt = $wk_jq(this).val();
- var regex = /(<([^>]+)>)/ig;
- var mainvald = validt .replace(regex, "");
- $wk_jq(this).val(mainvald);
- });
- $wk_jq(".dumimg").change(function(){
- $wk_jq( ".defaultimage" ).prop( "checked", false );
- });
- $wk_jq('input#sku').change(function(){
- var len=$wk_jq('input#sku').val();
- var len2=len.length;
- if(len2==0){
- alert('<?php echo $helper->__(" SKU can\'t be left empty ")?>');
- $wk_jq('div#skuavail').css('display','none');
- $wk_jq('div#skunotavail').css('display','none');
- }
- else{
- $wk_jq.ajax({
- url: "<?php echo Mage::getUrl('marketplace/marketplaceaccount/verifysku',array('_secure'=>true));?>",
- type: "POST",
- data: {sku:$wk_jq('input#sku').val()},
- dataType: 'html',
- success:function($data){
- $data=JSON.parse($data);
- if($data.avl==1){
- $wk_jq('div#skuavail').css('display','block');
- $wk_jq('div#skunotavail').css('display','none');
- }
- else{
- $wk_jq('div#skunotavail').css('display','block');
- $wk_jq('div#skuavail').css('display','none');
- $wk_jq("input#sku").attr('value','');
- }
- }
- });
- }
- });
- $wk_jq("body").delegate('.wk_imagevalidate',"change",function(){
- var ext = $wk_jq(this).val().split('.').pop().toLowerCase();
- if($wk_jq.inArray(ext, ['gif','png','jpg','jpeg']) == -1) {
- $wk_jq(this).val('');
- alert('<?php echo $helper->__(" invalid extension! Please Upload an image ")?>');
- }
- });
- $wk_jq("#wk_bodymain").delegate('.wk_plus ,.wk_plusend,.wk_minus, .wk_minusend ',"click",function(){
- var thisthis=$wk_jq(this);
- if(thisthis.hasClass("wk_plus") || thisthis.hasClass("wk_plusend")){
- if(thisthis.hasClass("wk_plus"))
- thisthis.removeClass('wk_plus').addClass('wk_plus_click');
- if(thisthis.hasClass("wk_plusend"))
- thisthis.removeClass('wk_plusend').addClass('wk_plusend_click');
- thisthis.prepend("<span class='wk_node_loader'></span>");
- $wk_jq.ajax({
- url : "<?php echo $this->getUrl('marketplace/marketplaceaccount/categorytree/',array('_secure'=>true));?>",
- type : "POST",
- data : {CID:thisthis.siblings("input").val(),
- ML:thisthis.parent(".wk_cat_container").css("margin-left").replace("px",""),
- CATS : "<?php echo implode(',',$categories); ?>"},
- dataType: "html",
- success : function(content){
- var newdata= $wk_jq.parseJSON(content);
- len= newdata.length;
- var pxl= parseInt(thisthis.parent(".wk_cat_container").css("margin-left").replace("px",""))+20;
- thisthis.find(".wk_node_loader").remove();
- if(thisthis.attr("class") == "wk_plus")
- thisthis.attr("class","wk_minus");
- if(thisthis.attr("class") == "wk_plusend")
- thisthis.attr("class","wk_minusend");
- if(thisthis.attr("class") == "wk_plus_click")
- thisthis.attr("class","wk_minus");
- if(thisthis.attr("class") == "wk_plusend_click")
- thisthis.attr("class","wk_minusend");
- for(i=0;i<len; i++){
- id=newdata[i].id;
- checkn=newdata[i].check;
- nam=newdata[i].name;
- if(checkn==1){
- if(newdata[i].counting ==0){
- thisthis.parent(".wk_cat_container").after('<div class="wk_removable wk_cat_container" style="display:none;margin-left:'+pxl+'px;"><span class="wk_no"></span><span class="wk_foldersign"></span><span class="wk_elements wk_cat_name">'+ nam +'</span><input class="wk_elements" type="checkbox" checked name="category[]" value='+ id+' </div>');
- }else{
- thisthis.parent(".wk_cat_container").after('<div class="wk_removable wk_cat_container" style="display:none;margin-left:'+pxl+'px;"><span class="wk_plusend"></span><span class="wk_foldersign"></span><span class="wk_elements wk_cat_name">'+ nam +'</span><input class="wk_elements" type="checkbox" checked name="category[]" value='+ id +'></div>');
- }
- }else{
- if(newdata[i].counting ==0){
- thisthis.parent(".wk_cat_container").after('<div class="wk_removable wk_cat_container" style="display:none;margin-left:'+pxl+'px;"><span class="wk_no"></span><span class="wk_foldersign"></span><span class="wk_elements wk_cat_name">'+ nam +'</span><input class="wk_elements" type="checkbox" name="category[]" value='+ id+'></div>');
- }else{
- thisthis.parent(".wk_cat_container").after('<div class="wk_removable wk_cat_container" style="display:none;margin-left:'+pxl+'px;"><span class="wk_plusend"></span><span class="wk_foldersign"></span><span class="wk_elements wk_cat_name">'+ nam +'</span><input class="wk_elements" type="checkbox" name="category[]" value='+ id +'></div>');
- }
- }
- }
- thisthis.parent(".wk_cat_container").nextAll().slideDown(300);
- }
- });
- }
- if(thisthis.hasClass("wk_minus") || thisthis.hasClass("wk_minusend")){
- if(thisthis.attr("class") == "wk_minus")
- thisthis.attr("class","wk_plus");
- if(thisthis.attr("class") == "wk_minusend")
- thisthis.attr("class","wk_plusend");
- var thiscategory = thisthis.parent(".wk_cat_container");
- var marg= parseInt(thiscategory.css("margin-left").replace("px",""));
- while(thiscategory.next().hasClass("wk_removable")){
- if(parseInt(thiscategory.next().css("margin-left").replace("px",""))>marg)
- thiscategory.next().slideUp("slow",function(){$wk_jq(this).remove();});
- thiscategory = thiscategory.next();
- if(typeof thiscategory.next().css("margin-left")!= "undefined"){
- if( marg==thiscategory.next().css("margin-left").replace("px",""))
- {
- break;
- }
- }
- }
- }
- });
- $wk_jq("body").delegate('.nicEdit-main',"blur",function(){
- var x = $wk_jq(this).text()
- $wk_jq(this).parent().parent().children('textarea').text(x);
- });
- $wk_jq('.image_set span').click(function(event){
- var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete this image ? ")?>');
- if(dicisionapp==true){
- var deleteflag=0;
- var thisthis = $wk_jq(this);
- var imag = thisthis.prev('img').attr('id');
- thisthis.html("<img src='<?php echo $this->getSkinUrl('marketplace/images/loading.gif'); ?>'/>");
- thisthis.removeClass('wk_imagedelete');
- thisthis.addClass('wk_imagedeleteload');
- $wk_jq.ajax({
- url: "<?php echo $this->getUrl('marketplace/marketplaceaccount/deleteimage',array('_secure'=>true));?>",
- type: "POST",
- data: {file:thisthis.prev('img').attr('id'),pid:thisthis.prev('img').attr('pid')},
- dataType: 'html',
- success:function(content){
- thisthis.parent('div.setimage').remove();
- }
- });
- }
- });
- $wk_jq('.wk_imagedelete img').mouseover(function(event){
- $wk_jq(event.target).css('width','22px');
- });
- $wk_jq('.wk_imagedelete img').mouseout(function(event){
- $wk_jq(event.target).css('width','20px');
- });
- })($wk_jq);
- </script>
- <?php
- }else{
- echo "<h2 class='wk_new_msg'>".$helper->__("To BECOME SELLER PLEASE CONTACT TO ADMIN.")."</h2>";
- }?>
- <style>
- .wk_mp_btn1 {background: #3fbdf7 none repeat scroll 0 0;color: #fff;}
- .social-icons {
- display:none !important; // this will work for you..
- }
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement