Get sample File URL for downloadable product in Magento 2 The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Downloadable product Export In magento2Magento 2: get Nextpage, Lastpage Url in list.phtml fileMagento 2 get frontend store url for a path in adminMagento 2: custom page for downloadable productMagento 2: Disable “Cash on delivery” for downloadable productsMagento 2 : How to watermark pdf of a downloadable product?which table save Downloadable-Product link and sample-titlehow to get main product image url in phtml file?Attach downloadable product to grouped product

should truth entail possible truth

Variable with quotation marks "$()"

Intergalactic human space ship encounters another ship, character gets shunted off beyond known universe, reality starts collapsing

Is this wall load bearing? Blueprints and photos attached

Do I have Disadvantage attacking with an off-hand weapon?

"... to apply for a visa" or "... and applied for a visa"?

Is there a writing software that you can sort scenes like slides in PowerPoint?

Homework question about an engine pulling a train

Why don't hard Brexiteers insist on a hard border to prevent illegal immigration after Brexit?

Drawing vertical/oblique lines in Metrical tree (tikz-qtree, tipa)

Why not take a picture of a closer black hole?

Word to describe a time interval

Huge performance difference of the command find with and without using %M option to show permissions

Is every episode of "Where are my Pants?" identical?

Loose spokes after only a few rides

Does Parliament need to approve the new Brexit delay to 31 October 2019?

Could an empire control the whole planet with today's comunication methods?

Why are PDP-7-style microprogrammed instructions out of vogue?

How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?

US Healthcare consultation for visitors

Example of compact Riemannian manifold with only one geodesic.

Accepted by European university, rejected by all American ones I applied to? Possible reasons?

For what reasons would an animal species NOT cross a *horizontal* land bridge?

How to handle characters who are more educated than the author?



Get sample File URL for downloadable product in Magento 2



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Downloadable product Export In magento2Magento 2: get Nextpage, Lastpage Url in list.phtml fileMagento 2 get frontend store url for a path in adminMagento 2: custom page for downloadable productMagento 2: Disable “Cash on delivery” for downloadable productsMagento 2 : How to watermark pdf of a downloadable product?which table save Downloadable-Product link and sample-titlehow to get main product image url in phtml file?Attach downloadable product to grouped product



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















How to get sample file url for a downloadable productenter image description here










share|improve this question

















  • 1





    what did you try so far?

    – magefms
    Apr 9 at 6:50

















0















How to get sample file url for a downloadable productenter image description here










share|improve this question

















  • 1





    what did you try so far?

    – magefms
    Apr 9 at 6:50













0












0








0








How to get sample file url for a downloadable productenter image description here










share|improve this question














How to get sample file url for a downloadable productenter image description here







magento2






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 9 at 6:25









Sanket MakavanaSanket Makavana

857




857







  • 1





    what did you try so far?

    – magefms
    Apr 9 at 6:50












  • 1





    what did you try so far?

    – magefms
    Apr 9 at 6:50







1




1





what did you try so far?

– magefms
Apr 9 at 6:50





what did you try so far?

– magefms
Apr 9 at 6:50










1 Answer
1






active

oldest

votes


















1














In Block Inject Downloadable Sample Collection



public function __construct(
.....,
.....,
MagentoDownloadableModelResourceModelSampleCollectionFactory $sampleCollectionFactory,
)
.....,
.....,
$this->_sampleCollectionFactory = $sampleCollectionFactory;


public function getSampleCollection($productId)
$collection = $this->_sampleCollectionFactory->create();
$collection->addProductToFilter($productId);
return $collection;



In Phtml File



 $_mySampleCollection = $this->getSampleCollection(1); 
foreach ($_mySampleCollection as $_sample):

echo $_sample->getSampleUrl();






share|improve this answer























    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "479"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269289%2fget-sample-file-url-for-downloadable-product-in-magento-2%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    In Block Inject Downloadable Sample Collection



    public function __construct(
    .....,
    .....,
    MagentoDownloadableModelResourceModelSampleCollectionFactory $sampleCollectionFactory,
    )
    .....,
    .....,
    $this->_sampleCollectionFactory = $sampleCollectionFactory;


    public function getSampleCollection($productId)
    $collection = $this->_sampleCollectionFactory->create();
    $collection->addProductToFilter($productId);
    return $collection;



    In Phtml File



     $_mySampleCollection = $this->getSampleCollection(1); 
    foreach ($_mySampleCollection as $_sample):

    echo $_sample->getSampleUrl();






    share|improve this answer



























      1














      In Block Inject Downloadable Sample Collection



      public function __construct(
      .....,
      .....,
      MagentoDownloadableModelResourceModelSampleCollectionFactory $sampleCollectionFactory,
      )
      .....,
      .....,
      $this->_sampleCollectionFactory = $sampleCollectionFactory;


      public function getSampleCollection($productId)
      $collection = $this->_sampleCollectionFactory->create();
      $collection->addProductToFilter($productId);
      return $collection;



      In Phtml File



       $_mySampleCollection = $this->getSampleCollection(1); 
      foreach ($_mySampleCollection as $_sample):

      echo $_sample->getSampleUrl();






      share|improve this answer

























        1












        1








        1







        In Block Inject Downloadable Sample Collection



        public function __construct(
        .....,
        .....,
        MagentoDownloadableModelResourceModelSampleCollectionFactory $sampleCollectionFactory,
        )
        .....,
        .....,
        $this->_sampleCollectionFactory = $sampleCollectionFactory;


        public function getSampleCollection($productId)
        $collection = $this->_sampleCollectionFactory->create();
        $collection->addProductToFilter($productId);
        return $collection;



        In Phtml File



         $_mySampleCollection = $this->getSampleCollection(1); 
        foreach ($_mySampleCollection as $_sample):

        echo $_sample->getSampleUrl();






        share|improve this answer













        In Block Inject Downloadable Sample Collection



        public function __construct(
        .....,
        .....,
        MagentoDownloadableModelResourceModelSampleCollectionFactory $sampleCollectionFactory,
        )
        .....,
        .....,
        $this->_sampleCollectionFactory = $sampleCollectionFactory;


        public function getSampleCollection($productId)
        $collection = $this->_sampleCollectionFactory->create();
        $collection->addProductToFilter($productId);
        return $collection;



        In Phtml File



         $_mySampleCollection = $this->getSampleCollection(1); 
        foreach ($_mySampleCollection as $_sample):

        echo $_sample->getSampleUrl();







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered yesterday









        Abdul KadirAbdul Kadir

        1116




        1116



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f269289%2fget-sample-file-url-for-downloadable-product-in-magento-2%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Sum ergo cogito? 1 nng

            419 nièngy_Soadمي 19bal1.5o_g

            Queiggey Chernihivv 9NnOo i Zw X QqKk LpB