Advertisement
pharmokan

amfile tearsheet import db sql php script update

Aug 24th, 2020
410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. #test area php run in console
  2. <?php
  3.  
  4. error_reporting(E_ALL);
  5. ini_set('display_errors', 1);
  6. ini_set('max_execution_time', 420);
  7. ?>
  8. <?php
  9. require_once 'app/Mage.php';
  10. Mage::app();
  11. ?>
  12.  
  13. <?php
  14. $copypasta = <<< EOC
  15. EOC;
  16. $skus = explode(PHP_EOL, $copypasta);
  17.  
  18. foreach ($skus as $prod) {
  19. $asdf = Mage::getModel('catalog/product')->loadByAttribute('sku', $prod);
  20. if($asdf) {
  21. $asdf->save();
  22. echo $asdf->getSku() . " Updated #" . PHP_EOL;
  23.  
  24. }
  25.  
  26. else {echo $prod . " not exist <br/>";}
  27. }
  28. ?>
  29.  
  30.  
  31. physical_filename name sku storis entity_id model_name filename(model_name_Tearsheet.pdf)
  32.  
  33.  
  34. INSERT INTO `am_file` (`file_id`, `product_id`, `file_url`, `file_name`, `file_link`) VALUES (NULL, # entity_id #, # phsyical_filename_on_media #, # front-facing-name.pdf #, ##);
  35.  
  36. INSERT INTO `am_file_store_customer_group` (`id`, `store_id`, `file_id`, `customer_group_id`, `is_active`) VALUES (NULL, #0#, # AUTO_INCREMENT_ID_FROM_SQL_STATEMENT_ABOVE #, #-1#, #1#);
  37.  
  38. INSERT INTO `am_file_store` (`id`, `file_id`, `store_id`, `label`, `visible`, `position`, `use_default_label`, `use_default_visible`, `show_ordered`, `use_default_show_ordered`, `use_default_customer_group`) VALUES (NULL, # AUTO_INCREMENT_ID_FROM_SQL_STATEMENT_ABOVE #, #0#, #Tearsheet#, #1#, #0#, #0#, #0#, #0#, #0#, #0#);
  39.  
  40.  
  41.  
  42.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement