Advertisement
Guest User

coded

a guest
Nov 25th, 2015
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 36.99 KB | None | 0 0
  1. <?php
  2. $isPartner= Mage::getModel('marketplace/userprofile')->isPartner();
  3. $helper= Mage::helper('marketplace');
  4. if($isPartner==1){
  5. ?>
  6. <script type="text/javascript">
  7. if (typeof jQuery == 'undefined'){
  8. document.write(unescape("%3Cscript src='//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'%3E%3C/script%3E"));
  9. }
  10. </script>
  11. <script src="//code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  12. <link rel="stylesheet" href="//code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  13. <div class="page-title">
  14. <h1 style="float:left;"><?php echo $helper->__('My Product List') ?></h1>
  15. </div>
  16. <div class="wk_mp_design">
  17. <div class="block block-account">
  18. <div class="block-title">
  19. <strong><span><h4><?php echo $helper->__('Product List') ?></h4></span></strong>
  20. </div>
  21. </div>
  22. <div class="fieldset wk_mp_fieldset">
  23. <div class="grid">
  24. <div class="hor-scroll">
  25. <form action="<?php echo Mage::helper('core/url')->getCurrentUrl();?>" method="post">
  26. <table cellspacing="0" class="border wk_mp_list_table">
  27. <thead>
  28. <tr id="wk_mp_tr_heading">
  29. <th><span><?php echo $helper->__('Product Name') ?></span></th>
  30. <th><span><?php echo $helper->__('Date') ?></span></th>
  31. <th><span><?php echo $helper->__('Product Status') ?></span></th>
  32. <th><span>&nbsp;</span></th>
  33. </tr>
  34. </thead>
  35. <tbody class="wk_mp_body">
  36. <tr>
  37. <td>
  38. <input type="text" class="input-text" name="s" placeholder='<?php echo $helper->__('Search by product name') ?>' value="<?php echo $this->getRequest()->getParam('s')?>"/>
  39. </td>
  40. <td>
  41. <span class="wk_mp_td_span">
  42. <?php echo $helper->__('From: ') ?>
  43. <input name="from_date" id="special_from_date" class="input-text" value="<?php echo $this->getRequest()->getParam('from_date')?>" />
  44. </span>
  45. <span class="wk_mp_td_span">
  46. <?php echo $helper->__('To: ') ?>
  47. <input name="to_date" id="special_to_date" class="input-text" value="<?php echo $this->getRequest()->getParam('to_date')?>" />
  48. </span>
  49. </td>
  50. <td>
  51. <select name="prostatus" class="input-text">
  52. <option value=""><?php echo $helper->__('All') ?></option>
  53. <option value="1" <?php if($this->getRequest()->getParam('prostatus') == 1) echo 'selected="selected"'?>>
  54. <?php echo $helper->__('Approved') ?>
  55. </option>
  56. <option value="2" <?php if($this->getRequest()->getParam('prostatus') == 2) echo 'selected="selected"'?>>
  57. <?php echo $helper->__('Unapproved') ?>
  58. </option>
  59. </select>
  60. </td>
  61. <td>
  62. <button class="button" title="Save" type="submit">
  63. <span><span><span><?php echo $helper->__('Submit') ?></span></span></span>
  64. </button>
  65. </td>
  66. </tr>
  67. </tbody>
  68. </table>
  69. </form>
  70. <?php
  71. if(count($this->getCollection())==0){ ?>
  72. <div class="fieldset wk_mp_fieldset">
  73. <div class="wk_emptymsg">
  74. <?php echo $helper->__('No Product Available') ?>
  75. </div>
  76. </div>
  77. <?php
  78. } else{ ?>
  79. <form action="<?php echo $this->getUrl('marketplace/marketplaceaccount/massdeletesellerpro') ?>" method="post" id="formmassdelete" name="formmassdelete">
  80. <input type="hidden" name="form_key" value="<?php echo Mage::getSingleton('core/session')->getFormKey(); ?>" />
  81. <button class="button" title="<?php echo $helper->__('Delete Products') ?>" type="submit" style="float: left;padding: 5px 5px 5px 0;" id="mass_delete_butn">
  82. <span><span><?php echo $helper->__('Delete Products') ?></span></span>
  83. </button>
  84. <table cellspacing="0" class="border wk_mp_list_table wk_mp_list_container_table">
  85. <thead>
  86. <tr class="wk_content">
  87. <th class="wk_check_first_td">
  88. <span>
  89. <input type="checkbox" name="mpselecctall" value="all" id="mpselecctall"/>
  90. </span>
  91. </th>
  92. <th class="wk_first_td">
  93. <span class="label name">
  94. <?php echo $helper->__('Product')?>
  95. </span>
  96. </th>
  97. <th>
  98. <span class="label">
  99. <?php echo $helper->__('sku')?>
  100. </span>
  101. </th>
  102.  
  103. <!-- status
  104. <th>
  105. <span class="label pro_status">
  106. <?php echo $helper->__('Status')?>
  107. </span>
  108. </th>
  109.  
  110. -->
  111. <th>
  112. <span class="label">
  113. <?php echo $helper->__('Price')?>
  114. </span>
  115. </th>
  116.  
  117. <th>
  118. <span class="label">
  119. <?php echo $helper->__('Special Price')?>
  120. </span>
  121. </th>
  122. <!--
  123. <th>
  124. <span class="label qty">
  125. <?php echo $helper->__('Qty. Confirmed')?>
  126. </span>
  127. </th>
  128. <th>
  129. <span class="label qty">
  130. <?php echo $helper->__('Qty. Pending')?>
  131. </span>
  132. </th>
  133. <th>
  134. <span class="label qty">
  135. <?php echo $helper->__('Qty. Sold')?>
  136. </span>
  137. </th>
  138. -->
  139. <th>
  140. <span class="label">
  141. <?php echo $helper->__('Qty')?>
  142. </span>
  143. </th>
  144.  
  145. <th>
  146. <span class="label">
  147. <?php echo $helper->__('Earn Amount')?>
  148. </span>
  149. </th>
  150. <th>
  151. <span class="label">
  152. <?php echo $helper->__('Action')?>
  153. </span>
  154. </th>
  155.  
  156. </tr>
  157. </thead>
  158. <tbody>
  159. <?php
  160. $i = 0;
  161. foreach($this->getCollection() as $products){
  162. $i++;
  163. $productMediaConfig = Mage::getModel('catalog/product_media_config');
  164. $salesdetail=Mage::getModel('marketplace/saleslist')->getSalesdetail($products->getEntityId());
  165. ?>
  166. <tr class="wk_row_view <?php echo $class = ($i == count($this->getCollection()))? 'wk_last_tr':''?>">
  167. <td class="wk_check_first_td">
  168. <span>
  169. <input type="checkbox" name="product_mass_delete[]" class="mpcheckbox" value="<?php echo $products->getEntityId(); ?>"/>
  170. </span>
  171. </td>
  172. <td class="wk_first_td">
  173. <input type="hidden" class="hidden_id" value="<?php echo $products->getEntityId(); ?>" />
  174. <div class="label name" title="<?php echo $products->getName(); ?>">
  175. <div class="wk_pro_divide1">
  176. <img src="<?php echo Mage::helper('catalog/image')->init($products,'thumbnail');?>" class="image" />
  177. </div>
  178. <div class="wk_pro_divide2">
  179. <div style="width:100%;">
  180. <a href="<?php echo $this->getUrl($products->getUrlPath())?>" target="blank">
  181. <?php echo $products->getName();?>
  182. </a>
  183. </div>
  184.  
  185. </div>
  186. </div>
  187. </td>
  188.  
  189. <td>
  190. <?php echo $sku = Mage::getModel('catalog/product')->load($products->getId())->getSku();?>
  191. </td>
  192. <?php
  193. if($products->getStatus()==2) { ?>
  194. <td>
  195. <span class="label pro_status">
  196. <?php echo $helper->__('Pending')?>
  197. </span>
  198. </td>
  199. <td>
  200. <span class="label qty">
  201. <?php echo $helper->__('Pending')?>
  202. </span>
  203. </td>
  204. <td>
  205. <span class="label qty">
  206. <?php echo $helper->__('Pending')?>
  207. </span>
  208. </td>
  209. <td>
  210. <span class="label qty">
  211. <?php echo $helper->__('Pending')?>
  212. </span>
  213. </td>
  214. <td>
  215. <span class="label qty">
  216. <?php echo $helper->__('Pending')?>
  217. </span>
  218. </td>
  219. <?php }
  220. else{
  221. $id=$products->getId();
  222. $productsolddetail=Mage::getModel('marketplace/saleslist')->getProductSalesDetailById($id);
  223. $qtycom=0;
  224. $com=0;
  225. foreach($productsolddetail as $key){
  226. $qtycom+=$key['magequantity'];
  227. $com+=$key['actualparterprocost'];
  228. } ?>
  229. <!-- Status
  230.  
  231. <td>
  232. <span class="label pro_status">
  233. <?php echo $helper->__('Approved')?>
  234. </span>
  235. </td>
  236.  
  237. -->
  238.  
  239. <!-- Price start -->
  240.  
  241. <td>
  242. <span class="label pro_status">
  243. <?php //echo $products->getPrice(); ?>
  244.  
  245. <span id="valueprice_<?php echo $products->getId(); ?>"><?php echo $products->getPrice(); ?></span>
  246. <input type = "text" id = "price_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" "name = "price" value = "<?php echo $products->getPrice(); ?>" style = "display:none"/>
  247.  
  248.  
  249.  
  250. <span class="label wk_action" id="edit_link_<?php echo $products->getId(); ?>">
  251. <img onclick="showFieldPrice('<?php echo $products->getId(); ?>'); return false;" src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
  252. </span>
  253. <p id="updatedprice_<?php echo $products->getId(); ?>" style = "display:none;color:red;">Updated</p>
  254. <br/>
  255. <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" >
  256. <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
  257. </button>
  258. <button id="price_reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideResetPrice('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
  259. <span><span><?php echo $helper->__('Cancel') ?></span></span>
  260. </button>
  261. </span>
  262. </td>
  263.  
  264. <!-- price end -->
  265.  
  266. <!-- SP start -->
  267.  
  268. <td>
  269. <span class="label pro_status">
  270. <?php //echo $products->getPrice(); ?>
  271.  
  272. <span id="valueprice_<?php echo $products->getId(); ?>"><?php echo $products->getSpecialPrice(); ?></span>
  273. <input type = "text" id = "specialprice_<?php echo $products->getId(); ?>" onkeydown="validateNumbers(event)" "name = "price" value = "<?php echo $products->getSpecialPrice(); ?>" style = "display:none"/>
  274.  
  275.  
  276.  
  277. <span class="label wk_action" id="edit_link_<?php echo $products->getId(); ?>">
  278. <img onclick="showFieldSpecialPrice('<?php echo $products->getId(); ?>'); return false;" src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
  279. </span>
  280. <p id="updatedspecialprice_<?php echo $products->getId(); ?>" style = "display:none;color:red;">Updated</p>
  281. <br/>
  282. <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" >
  283. <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
  284. </button>
  285. <button id="specialprice_reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideResetSpecialPrice('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
  286. <span><span><?php echo $helper->__('Cancel') ?></span></span>
  287. </button>
  288. </span>
  289. </td>
  290.  
  291. <!-- SP end-->
  292.  
  293.  
  294. <!-- qty start -->
  295. <td>
  296.  
  297. <span id="valueqty_<?php echo $products->getId(); ?>"><?php echo (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($products)->getQty(); ?></span>
  298. <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"/>
  299.  
  300.  
  301.  
  302. <span class="label wk_action" id="edit_link_<?php echo $products->getId(); ?>">
  303. <img onclick="showField('<?php echo $products->getId(); ?>'); return false;" src="<?php echo $this->getSkinUrl('marketplace/images/icon-edit.png'); ?>"/>
  304. </span>
  305. <p id="updatedqty_<?php echo $products->getId(); ?>" style = "display:none;color:red;">Updated</p>
  306. <br/>
  307. <button id="update_button_<?php echo $products->getId(); ?>" class="button wk_mp_btn1" onclick="updateField('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
  308. <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
  309. </button>
  310.  
  311. <button id="reset_button_<?php echo $products->getId(); ?>" type="reset" class="cancel" onclick="hideReset('<?php echo $products->getId(); ?>'); return false;" style="display:none" >
  312. <span><span><?php echo $helper->__('Cancel') ?></span></span>
  313. </button>
  314.  
  315.  
  316.  
  317.  
  318. <!-- edit qty end 2 -->
  319.  
  320.  
  321.  
  322. <!--
  323. <td>
  324. <span class="label qty">
  325. <?php echo $salesdetail['quantitysoldconfirmed']; ?>
  326. </span>
  327. </td>
  328. <td>
  329. <span class="label qty">
  330. <?php echo $salesdetail['quantitysoldpending']; ?>
  331. </span>
  332. </td>
  333. <td>
  334. <span class="label qty">
  335. <a href="<?php echo $this->getUrl('mpshippingmanager/shipping/salesdetail/')."id/".$products->getId(); ?>"><?php echo $salesdetail['quantitysold']; ?></a>
  336. </span>
  337. </td>
  338. -->
  339. <td>
  340. <span class="label price">
  341. <?php echo Mage::helper('core')->currency($salesdetail['amountearned'], true, false); ?>
  342. </span>
  343. </td>
  344. <td>
  345. <button id="update_button_<?php echo $products->getId(); ?>" class="button wk_mp_btn1" onclick="updateAllFields('<?php echo $products->getId(); ?>'); return false;" >
  346. <span><span style="font-size:12px;"><?php echo $helper->__('Update') ?></span></span>
  347. </button>
  348.  
  349.  
  350. </td>
  351.  
  352. <?php
  353. }?>
  354. <td>
  355. <span class="label wk_action">
  356. <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"/>
  357. <img src="<?php echo $this->getSkinUrl('marketplace/images/icon-trash.png'); ?>" alt="<?php echo $helper->__('Delete')?>" title="<?php echo $helper->__('Delete')?>" class="mp_delete"/>
  358. </span>
  359. </td>
  360. </tr>
  361. <?php
  362. }?>
  363. </tbody>
  364. </table>
  365. </form>
  366. <?php
  367. }?>
  368. </div>
  369. </div>
  370. <?php echo $this->getPagerHtml(); ?>
  371. </div>
  372. <div class="buttons-set">
  373. <p class="back-link">
  374. <a href="javascript:;" onclick="javascript: window.history.back();" class="left">&laquo; <?php echo $helper->__('Back') ?></a>
  375. </p>
  376. </div>
  377. </div>
  378.  
  379.  
  380.  
  381. <!-- edit qty start 2-->
  382.  
  383. <?php $url = Mage::getUrl('module_name/index/updateField/'); ?>
  384. <?php $url = Mage::getUrl('marketplaceaccountcontroller/index/updateField/'); ?>
  385.  
  386.  
  387. <!-- aki 2 -->
  388. <script type = "text/javascript" >
  389. function validateNumbers(e) {
  390. //var key = '#keyinput_'+ product_id;
  391. //var e = jQuery(key);
  392.  
  393. if (jQuery.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
  394. // Allow: Ctrl+A, Command+A
  395. (e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) ||
  396. // Allow: home, end, left, right, down, up
  397. (e.keyCode >= 35 && e.keyCode <= 40)) {
  398. // let it happen, don't do anything
  399. return;
  400. }
  401. // Ensure that it is a number and stop the keypress
  402. if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
  403. e.preventDefault();
  404. }
  405. }
  406. var $wk_jq = jQuery.noConflict();
  407.  
  408. function hideReset(product_id) {
  409.  
  410. var qtyId='#qty_'+ product_id;
  411. var editLink="#edit_link_"+ product_id;
  412. var updateButton="#update_button_"+ product_id;
  413. var resetButton="#reset_button_"+ product_id;
  414.  
  415. $wk_jq(qtyId).hide();
  416. $wk_jq(editLink).show();
  417. $wk_jq(updateButton).hide();
  418. $wk_jq(resetButton).hide();
  419. }
  420.  
  421. function hideResetPrice(product_id) {
  422.  
  423. var qtyId='#price_'+ product_id;
  424. var editLink="#price_edit_link_"+ product_id;
  425. var updateButton="#price_update_button_"+ product_id;
  426. var resetButton="#price_reset_button_"+ product_id;
  427.  
  428. $wk_jq(qtyId).hide();
  429. $wk_jq(editLink).show();
  430. $wk_jq(updateButton).hide();
  431. $wk_jq(resetButton).hide();
  432. }
  433.  
  434. <!-- code for special price -->
  435. function hideResetSpecialPrice(product_id) {
  436.  
  437. var qtyId='#specialprice_'+ product_id;
  438. var editLink="#specialprice_edit_link_"+ product_id;
  439. var updateButton="#specialprice_update_button_"+ product_id;
  440. var resetButton="#specialprice_reset_button_"+ product_id;
  441.  
  442. $wk_jq(qtyId).hide();
  443. $wk_jq(editLink).show();
  444. $wk_jq(updateButton).hide();
  445. $wk_jq(resetButton).hide();
  446. }
  447.  
  448. <!-- code for special price end -->
  449.  
  450.  
  451. function showField(product_id)
  452. {
  453.  
  454. var qtyId='#qty_'+ product_id;
  455.  
  456. var editLink="#edit_link_"+ product_id;
  457. var updateButton="#update_button_"+ product_id;
  458. var resetButton="#reset_button_"+ product_id;
  459.  
  460. $wk_jq(qtyId).show();
  461.  
  462. $wk_jq(editLink).hide();
  463. $wk_jq(updateButton).show();
  464. $wk_jq(updateButton).prop('disabled', false);//just in case
  465. $wk_jq(resetButton).show();
  466.  
  467. return false;
  468.  
  469.  
  470. }
  471.  
  472. function showFieldPrice(product_id)
  473. {
  474.  
  475. var qtyId='#price_'+ product_id;
  476.  
  477. var editLink="#price_edit_link_"+ product_id;
  478. var updateButton="#price_update_button_"+ product_id;
  479. var resetButton="#price_reset_button_"+ product_id;
  480.  
  481. $wk_jq(qtyId).show();
  482.  
  483. $wk_jq(editLink).hide();
  484. $wk_jq(updateButton).show();
  485. $wk_jq(updateButton).prop('disabled', false);//just in case
  486. $wk_jq(resetButton).show();
  487.  
  488. return false;
  489.  
  490.  
  491. }
  492.  
  493. <!-- sp start -->
  494. function showFieldSpecialPrice(product_id)
  495. {
  496.  
  497. var qtyId='#specialprice_'+ product_id;
  498.  
  499. var editLink="#specialprice_edit_link_"+ product_id;
  500. var updateButton="#specialprice_update_button_"+ product_id;
  501. var resetButton="#specialprice_reset_button_"+ product_id;
  502.  
  503. $wk_jq(qtyId).show();
  504.  
  505. $wk_jq(editLink).hide();
  506. $wk_jq(updateButton).show();
  507. $wk_jq(updateButton).prop('disabled', false);//just in case
  508. $wk_jq(resetButton).show();
  509.  
  510. return false;
  511.  
  512.  
  513. }
  514.  
  515. <!-- sp end -->
  516.  
  517. function updateField(product_id)
  518. {
  519. var qtyId = '#qty_'+ product_id;
  520. var valueId = '#valueqty_'+ product_id;
  521. var updatedqty = '#updatedqty_'+ product_id;
  522.  
  523.  
  524. var editLink = "#edit_link_"+ product_id;
  525. var updateButton = "#update_button_"+ product_id;
  526. var resetButton = "#reset_button"+ product_id;
  527. var url ='<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateField/')?>';
  528.  
  529. $wk_jq(qtyId).toggle()
  530.  
  531. $wk_jq(editLink).hide();
  532. $wk_jq(updateButton).show();
  533. $wk_jq(resetButton).show();
  534.  
  535. $qty = $wk_jq(qtyId).val();
  536. jQuery(valueId).html($qty);
  537. hideReset(product_id);
  538.  
  539. new Ajax.Request(url, {
  540. method: 'post',
  541. parameters: {id: product_id, qty: $qty},
  542. onComplete: function (transport) {
  543. //alert(transport.responseText);
  544.  
  545.  
  546. jQuery(updatedqty).show().delay(2000).fadeOut();
  547.  
  548. $updateButton.prop('disabled', false);
  549.  
  550. $wk_jq(qtyId).setValue($qty);
  551.  
  552.  
  553.  
  554. }
  555. });
  556. }
  557.  
  558. function updateFieldPrice(product_id)
  559. {
  560. var priceId = '#price_'+ product_id;
  561. var valueId = '#valueprice_'+ product_id;
  562. var updatedqty = '#updatedprice_'+ product_id;
  563.  
  564.  
  565. var editLink = "#price_edit_link_"+ product_id;
  566. var updateButton = "#price_update_button_"+ product_id;
  567. var resetButton = "#price_reset_button_"+ product_id;
  568. var url ='<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateFieldPrice/')?>';
  569.  
  570. $wk_jq(priceId).toggle()
  571.  
  572. $wk_jq(editLink).hide();
  573. $wk_jq(updateButton).hide();
  574. $wk_jq(resetButton).hide();
  575.  
  576. $price = $wk_jq(priceId).val();
  577. jQuery(valueId).html($price);
  578. hideReset(product_id);
  579.  
  580. new Ajax.Request(url, {
  581. method: 'post',
  582. parameters: {id: product_id, price: $price},
  583. onComplete: function (transport) {
  584. //alert(transport.responseText);
  585.  
  586. jQuery(updatedqty).show().delay(2000).fadeOut();
  587.  
  588. $updateButton.prop('disabled', false);
  589.  
  590. $wk_jq(priceId).setValue($price);
  591.  
  592.  
  593.  
  594. }
  595. });
  596. }
  597.  
  598.  
  599.  
  600. <!-- js code for SP start -->
  601.  
  602. function updateFieldSpecialPrice(product_id)
  603. {
  604. var priceId = '#specialprice_'+ product_id;
  605. var valueId = '#valuespecialprice_'+ product_id;
  606. var updatedqty = '#updatedspecialprice_'+ product_id;
  607.  
  608.  
  609. var editLink = "#specialprice_edit_link_"+ product_id;
  610. var updateButton = "#specialprice_update_button_"+ product_id;
  611. var resetButton = "#specialprice_reset_button_"+ product_id;
  612. var url ='<?php echo Mage::getUrl('marketplace/marketplaceaccount/updateFieldSpecialPrice/')?>';
  613.  
  614. $wk_jq(priceId).toggle()
  615.  
  616. $wk_jq(editLink).hide();
  617. $wk_jq(updateButton).hide();
  618. $wk_jq(resetButton).hide();
  619.  
  620. $price = $wk_jq(priceId).val();
  621. jQuery(valueId).html($price);
  622. hideReset(product_id);
  623.  
  624. new Ajax.Request(url, {
  625. method: 'post',
  626. parameters: {id: product_id, price: $price},
  627. onComplete: function (transport) {
  628. //alert(transport.responseText);
  629.  
  630. jQuery(updatedqty).show().delay(2000).fadeOut();
  631.  
  632. $updateButton.prop('disabled', false);
  633.  
  634. $wk_jq(priceId).setValue($price);
  635.  
  636.  
  637.  
  638. }
  639. });
  640. }
  641.  
  642. <!-- js code for SP end -->
  643.  
  644.  
  645. function updateAllFields(product_id) {
  646. updateFieldPrice(product_id);
  647. updateFieldSpecialPrice(product_id);
  648. updateField(product_id);
  649.  
  650. }
  651. </script>
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659. <script>
  660. var $wk_jq=jQuery.noConflict();
  661. var newCustomerProductForm1 = new VarienForm('formmassdelete', true);
  662. (function($wk_jq){
  663. $wk_jq( "#special_from_date" ).datepicker({dateFormat: "yy-mm-dd"});
  664. $wk_jq( "#special_to_date" ).datepicker({dateFormat: "yy-mm-dd"});
  665. $wk_jq('body').delegate('.mp_edit','click',function(){
  666. var id=$wk_jq(this).parents('.wk_row_view').find('.hidden_id').val();
  667. var dicision=confirm('<?php echo $helper->__(" Are you sure you want to edit this product ? ")?>');
  668. if(dicision==true){
  669. var $type_id=$wk_jq(this).attr('data-type');
  670. if($type_id=='simple')
  671. window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/editapprovedsimple/') ?>".concat("id/",id);
  672. if($type_id=='downloadable')
  673. window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/editapproveddownloadable/') ?>".concat("id/",id);
  674. if($type_id=='virtual')
  675. window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/editapprovedvirtual/') ?>".concat("id/",id);
  676. if($type_id=='configurable')
  677. window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/editapprovedconfigurable/') ?>".concat("id/",id);
  678. if($type_id=='grouped')
  679. window.location = "<?php echo $this->getUrl('mpgroupproduct/index/editapprovedgrouped/') ?>".concat("id/",id);
  680. <?php
  681. //echo $this->getChildHtml('mpgrouped_productslist');
  682. // echo $this->getChildHtml('mpbundle_productslist');
  683. ?>
  684. if($type_id=='bundle')
  685. window.location = "<?php echo $this->getUrl('mpbundleproduct/index/editbundle/') ?>".concat("id/",id);
  686. }
  687. });
  688. $wk_jq('#mass_delete_butn').click(function(e){
  689. var flag =0;
  690. $wk_jq('.mpcheckbox').each(function(){
  691. if (this.checked == true){
  692. flag =1;
  693. }
  694. });
  695. if (flag == 0){
  696. alert("<?php echo $helper->__(' No Checkbox is checked ') ?>");
  697. return false;
  698. }
  699. else{
  700. var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete these product ? ")?>');
  701. if(dicisionapp==true){
  702. $wk_jq('#form-customer-product-new').submit();
  703. }else{
  704. return false;
  705. }
  706. }
  707. });
  708.  
  709. $wk_jq('#mpselecctall').click(function(event) {
  710. if(this.checked) {
  711. $wk_jq('.mpcheckbox').each(function() {
  712. this.checked = true;
  713. });
  714. }else{
  715. $wk_jq('.mpcheckbox').each(function() {
  716. this.checked = false;
  717. });
  718. }
  719. });
  720.  
  721. $wk_jq('.mp_delete').click(function(){
  722. var id=$wk_jq(this).parents('.wk_row_view').find('.hidden_id').val();
  723. var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete this product ? ")?>');
  724. if(dicisionapp==true)
  725. window.location = "<?php echo $this->getUrl('marketplace/marketplaceaccount/delete/') ?>".concat("id/",id);
  726. });
  727. })($wk_jq);
  728. </script>
  729.  
  730.  
  731. <script>
  732. var $wk_jq=jQuery.noConflict();
  733. var i=2;
  734. function showOtherImage(){
  735. var newdiv = document.createElement('div');
  736. newdiv.setAttribute("id","childDiv"+i);
  737. 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>";
  738. var ni = document.getElementById('otherimages');
  739. ni.appendChild(newdiv);
  740. i++;
  741. }
  742. function removeEvent(divNum){
  743. var d = document.getElementById('otherimages');
  744. var olddiv = document.getElementById(divNum);
  745. d.removeChild(olddiv);
  746. i--;
  747. }
  748. function defaultimagevalue(object){
  749. var strs=$wk_jq(object).prev('input').val().split('\\');
  750. $wk_jq(object).val(strs[strs.length-1]);
  751. }
  752. (function($wk_jq){
  753. var newCustomerProductForm = new VarienForm('form-customer-product-editPost', true);
  754. $wk_jq( "#special_from_date" ).datepicker({'dateFormat':'yy:mm:dd'});
  755. $wk_jq( "#special_to_date" ).datepicker({'dateFormat':'yy:mm:dd'});
  756.  
  757. $wk_jq('.wk_close').click(function(){
  758. $wk_jq(this).parent().remove();
  759. });
  760.  
  761. $wk_jq('#save_butn').click(function(e){
  762. if(newCustomerProductForm.validator.validate()!=false){
  763. var descrip = nicEditors.findEditor( "description" ).getContent();
  764. var sdescrip = nicEditors.findEditor( "short_description" ).getContent();
  765. //var regex = /(&lt([^>]+)&gt)/ig;
  766. var regex = /<script(.+?)<\/script>/g;
  767. var result = descrip .replace(regex, "");
  768. result = result.replace(/script/g,'');
  769. nicEditors.findEditor( "description" ).setContent(result);
  770.  
  771. var sresult = sdescrip .replace(regex, "");
  772. sresult = sresult.replace(/script/g,'');
  773. nicEditors.findEditor( "short_description" ).setContent(sresult);
  774.  
  775. $wk_jq('#description').text(result);
  776. $wk_jq('#short_description').text(sresult);
  777.  
  778. $wk_jq('#save_butn span span').text('<?php echo $helper->__(" Saving..")?>');
  779. $wk_jq('.button').css('opacity','0.7');
  780. $wk_jq('.button').css('cursor','default');
  781. $wk_jq('.button').attr('disabled','disabled');
  782. $wk_jq('#form-customer-product-editPost').submit();
  783. }
  784. });
  785.  
  786. $wk_jq('.input-text').change(function(){
  787. var validt = $wk_jq(this).val();
  788. var regex = /(<([^>]+)>)/ig;
  789. var mainvald = validt .replace(regex, "");
  790. $wk_jq(this).val(mainvald);
  791. });
  792.  
  793. $wk_jq(".dumimg").change(function(){
  794. $wk_jq( ".defaultimage" ).prop( "checked", false );
  795. });
  796. $wk_jq('input#sku').change(function(){
  797. var len=$wk_jq('input#sku').val();
  798. var len2=len.length;
  799. if(len2==0){
  800. alert('<?php echo $helper->__(" SKU can\'t be left empty ")?>');
  801. $wk_jq('div#skuavail').css('display','none');
  802. $wk_jq('div#skunotavail').css('display','none');
  803. }
  804. else{
  805. $wk_jq.ajax({
  806. url: "<?php echo Mage::getUrl('marketplace/marketplaceaccount/verifysku',array('_secure'=>true));?>",
  807. type: "POST",
  808. data: {sku:$wk_jq('input#sku').val()},
  809. dataType: 'html',
  810. success:function($data){
  811. $data=JSON.parse($data);
  812. if($data.avl==1){
  813. $wk_jq('div#skuavail').css('display','block');
  814. $wk_jq('div#skunotavail').css('display','none');
  815. }
  816. else{
  817. $wk_jq('div#skunotavail').css('display','block');
  818. $wk_jq('div#skuavail').css('display','none');
  819. $wk_jq("input#sku").attr('value','');
  820. }
  821. }
  822. });
  823. }
  824. });
  825.  
  826. $wk_jq("body").delegate('.wk_imagevalidate',"change",function(){
  827. var ext = $wk_jq(this).val().split('.').pop().toLowerCase();
  828. if($wk_jq.inArray(ext, ['gif','png','jpg','jpeg']) == -1) {
  829. $wk_jq(this).val('');
  830. alert('<?php echo $helper->__(" invalid extension! Please Upload an image ")?>');
  831. }
  832. });
  833.  
  834. $wk_jq("#wk_bodymain").delegate('.wk_plus ,.wk_plusend,.wk_minus, .wk_minusend ',"click",function(){
  835. var thisthis=$wk_jq(this);
  836. if(thisthis.hasClass("wk_plus") || thisthis.hasClass("wk_plusend")){
  837. if(thisthis.hasClass("wk_plus"))
  838. thisthis.removeClass('wk_plus').addClass('wk_plus_click');
  839. if(thisthis.hasClass("wk_plusend"))
  840. thisthis.removeClass('wk_plusend').addClass('wk_plusend_click');
  841. thisthis.prepend("<span class='wk_node_loader'></span>");
  842.  
  843. $wk_jq.ajax({
  844. url : "<?php echo $this->getUrl('marketplace/marketplaceaccount/categorytree/',array('_secure'=>true));?>",
  845. type : "POST",
  846. data : {CID:thisthis.siblings("input").val(),
  847. ML:thisthis.parent(".wk_cat_container").css("margin-left").replace("px",""),
  848. CATS : "<?php echo implode(',',$categories); ?>"},
  849. dataType: "html",
  850. success : function(content){
  851. var newdata= $wk_jq.parseJSON(content);
  852. len= newdata.length;
  853. var pxl= parseInt(thisthis.parent(".wk_cat_container").css("margin-left").replace("px",""))+20;
  854. thisthis.find(".wk_node_loader").remove();
  855. if(thisthis.attr("class") == "wk_plus")
  856. thisthis.attr("class","wk_minus");
  857. if(thisthis.attr("class") == "wk_plusend")
  858. thisthis.attr("class","wk_minusend");
  859. if(thisthis.attr("class") == "wk_plus_click")
  860. thisthis.attr("class","wk_minus");
  861. if(thisthis.attr("class") == "wk_plusend_click")
  862. thisthis.attr("class","wk_minusend");
  863. for(i=0;i<len; i++){
  864. id=newdata[i].id;
  865. checkn=newdata[i].check;
  866. nam=newdata[i].name;
  867. if(checkn==1){
  868. if(newdata[i].counting ==0){
  869. 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>');
  870. }else{
  871. 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>');
  872. }
  873. }else{
  874. if(newdata[i].counting ==0){
  875. 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>');
  876. }else{
  877. 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>');
  878. }
  879. }
  880. }
  881. thisthis.parent(".wk_cat_container").nextAll().slideDown(300);
  882. }
  883. });
  884. }
  885. if(thisthis.hasClass("wk_minus") || thisthis.hasClass("wk_minusend")){
  886. if(thisthis.attr("class") == "wk_minus")
  887. thisthis.attr("class","wk_plus");
  888. if(thisthis.attr("class") == "wk_minusend")
  889. thisthis.attr("class","wk_plusend");
  890. var thiscategory = thisthis.parent(".wk_cat_container");
  891. var marg= parseInt(thiscategory.css("margin-left").replace("px",""));
  892. while(thiscategory.next().hasClass("wk_removable")){
  893.  
  894. if(parseInt(thiscategory.next().css("margin-left").replace("px",""))>marg)
  895. thiscategory.next().slideUp("slow",function(){$wk_jq(this).remove();});
  896. thiscategory = thiscategory.next();
  897. if(typeof thiscategory.next().css("margin-left")!= "undefined"){
  898. if( marg==thiscategory.next().css("margin-left").replace("px",""))
  899. {
  900. break;
  901. }
  902. }
  903. }
  904. }
  905. });
  906.  
  907. $wk_jq("body").delegate('.nicEdit-main',"blur",function(){
  908. var x = $wk_jq(this).text()
  909. $wk_jq(this).parent().parent().children('textarea').text(x);
  910. });
  911.  
  912. $wk_jq('.image_set span').click(function(event){
  913. var dicisionapp=confirm('<?php echo $helper->__(" Are you sure you want to delete this image ? ")?>');
  914. if(dicisionapp==true){
  915. var deleteflag=0;
  916. var thisthis = $wk_jq(this);
  917. var imag = thisthis.prev('img').attr('id');
  918. thisthis.html("<img src='<?php echo $this->getSkinUrl('marketplace/images/loading.gif'); ?>'/>");
  919. thisthis.removeClass('wk_imagedelete');
  920. thisthis.addClass('wk_imagedeleteload');
  921. $wk_jq.ajax({
  922. url: "<?php echo $this->getUrl('marketplace/marketplaceaccount/deleteimage',array('_secure'=>true));?>",
  923. type: "POST",
  924. data: {file:thisthis.prev('img').attr('id'),pid:thisthis.prev('img').attr('pid')},
  925. dataType: 'html',
  926. success:function(content){
  927. thisthis.parent('div.setimage').remove();
  928. }
  929. });
  930. }
  931. });
  932. $wk_jq('.wk_imagedelete img').mouseover(function(event){
  933. $wk_jq(event.target).css('width','22px');
  934. });
  935. $wk_jq('.wk_imagedelete img').mouseout(function(event){
  936. $wk_jq(event.target).css('width','20px');
  937. });
  938. })($wk_jq);
  939. </script>
  940.  
  941.  
  942.  
  943.  
  944.  
  945. <?php
  946. }else{
  947. echo "<h2 class='wk_new_msg'>".$helper->__("To BECOME SELLER PLEASE CONTACT TO ADMIN.")."</h2>";
  948. }?>
  949.  
  950.  
  951.  
  952.  
  953. <style>
  954.  
  955. .wk_mp_btn1 {background: #3fbdf7 none repeat scroll 0 0;color: #fff;}
  956. .social-icons {
  957. display:none !important; // this will work for you..
  958. }
  959.  
  960.  
  961. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement