Posts

Showing posts from July, 2017

Upload Multiple files to folder in Magento ,Magento2

Upload Multiple images in Magento, Magento2.                         /*   $fname get the all images and $upload change array to comma seperated */                         $fname = $_FILES['upload_file']['name'];                                   $upload = implode (", ", $fname);                                                                                       if(isset($_POST['submit_image']))    /*  submit_image   name of the submit button */                         {     ...

Add Read More OR View More at any place in between to other file

Add Read More at any place to open in next page. <?php $string = $col->getDetails();     /*  Collection data getting is equal to string   */                  if (strlen($string) > 25) {                  $trimstring = substr($string, 0, 250). ' <a href="event/index/new"> Readmore... </a>';                   } else {                   $trimstring = $string;                   }                   echo $trimstring;                   ?>

UPload Single File In Magento

Upload Single file in Magento <?php /* UPLOAD FILE IN MAGENTO  [filename = name of file ]*/    if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '')                     {                         try                         {                                 $path = Mage::getBaseDir('media').DS."vendorplace/uploadedfiles/uploadfiles".DS; //desitnation directory where upload files are saved                             $fname = $_FILES['filename']['name']; //file name  comes out                             // echo "<pre>++++"; ...

Create a new Website ,Store and Store View by Programming in magento2

Create a file with any name in root and run it. <?php ini_set('display_errors', 1); error_reporting(E_ALL | E_STRICT); use Magento\Framework\App\Bootstrap; require __DIR__ . '/app/bootstrap.php'; $bootstrap = Bootstrap::create(BP, $_SERVER); $obj = $bootstrap->getObjectManager(); $state = $obj->get('Magento\Framework\App\State'); $state->setAreaCode('frontend'); $storeManager = $obj->get('\Magento\Store\Model\StoreManagerInterface'); $websiteFactory = $obj->get('\Magento\Store\Model\WebsiteFactory'); $groupResourceModel=$obj->get('Magento\Store\Model\ResourceModel\Group'); $storeFactory=$obj->get('Magento\Store\Model\StoreFactory'); $groupFactory=$obj->get('Magento\Store\Model\GroupFactory'); $eventManager=$obj->get('Magento\Framework\Event'); $storeModel     = $obj->create('Magento\Store\Model\Store'); $new_store = $websiteFactory->cr...