Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 4 of 4
Adding new features - video and .pdf documents on the detailed product view page
 
josuito
Jr. Member
 
Total Posts:  2
Joined:  2011-12-12
 

I’m not sure if this topic is solved or not but I create a page that only users can download a pdf file for products that they had bought and completed transactions.

1- I create a page in CMS in my admin panel and add the following code in in the content section then save it (don’t try to preview it, there’s nothing inside yet):

{{block type="core/template" template="customphp/download-pdfs.phtml"}}

2- I went to my cpanel (file manager) then a create a directory called “customphp”, then I created a file inside this directory called “download-pdfs.phtml” in this path app/design/frontend/default/your-theme/template/ and added the following code. I know there’s better ways to do it but Im not an expert.

<?php

Mage
::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

if(
Mage::getSingleton('customer/session')->isLoggedIn()){
    $customerData 
Mage::getSingleton('customer/session')->getCustomer();
    
$cid $customerData->getId();


$orderCollection Mage::getModel('sales/order')->getCollection()
    ->
addFieldToFilter('customer_id', array('eq' => array($cid)));    



     echo 
"<b>Please click in your product's download link. NOTE: Only completed/Pending/Processing orders will have a download link. (ID.CSC$cid)</b>";
     echo 
"<table class=\"none\" border=\"1\"> 
     <tr bgcolor=\"
#1f1f1f\">
     
<th><center><b>Order ID</b></th
     <
th><center><b>Product Name</b></th>  
     <
th><center><b>Product SKU</b></th>
     <
th><center><b>Category Name</b></th>
     <
th><center><b>Qty</b></th
     <
th><center><b>Status</b></th
     <
th><center><b>Created</b></th
     <
th><center><b>Download Link</b></center></th
     </
tr>";
     echo "
<ol class=\"products-list\" id=\"products-list\">";

foreach(
$orderCollection AS $order_row){
        Mage::log(
$order_row->getData());

$order = Mage::getModel('sales/order')->loadByIncrementId($order_row['increment_id']);
// get order total value
$orderValue = number_format ($order->getGrandTotal(), 2, '.' , $thousands_sep = '');
// get order item collection
$orderItems = $order->getItemsCollection();

 
foreach (
$orderItems as $item){
 
    
$product_id = $item->product_id;
    
$product_sku = $item->sku;
    
$product_name = $item->getName();
    
$_product = Mage::getModel('catalog/product')->load($product_id);
    
$product_pdfpath = $_product->getResource()->getAttribute('pdfpath')->getFrontend()->getValue($_product);
    
$cats = $_product->getCategoryIds();
    
$category_id = $cats[0]; // just grab the first id
    
$category = Mage::getModel('catalog/category')->load($category_id);
    
$category_name = $category->getName();

         
$encryptedData = Mage::helper('core')->encrypt($product_pdfpath);
         
$formatted = number_format($order_row['total_qty_ordered'], 0, '.', ' ');
         echo "
<tr>";
         echo "
<td><center>".$order_row['increment_id']."</center></td>";

 
    echo "
<td><center>".$product_name."</center></td>";
    echo "
<td><center>".$product_sku."</center></td>";
    echo "
<td><center>".$category_name."</center></td>";
 
 
             echo "
<td><center>".$formatted."</td>"; 
             echo "
<td><center>".$order_row['status']."</center></td>"; 
             echo "
<td><center>".$order_row['created_at']."</center></td>";

     if(
$order_row['status']=='canceled'){ 
             echo "
<td><center>Buy It</center></td>";
     }
     else {
             echo "
<td><center> <a target=\"_blank\" href=\"[removed]if(confirm('The PDF DWG will open in other page.')) [removed]='http://www.yourwebsite.com//product-pdfs/".$product_pdfpath."'; \"  download><b>Download</b></a></center></td>"; 
     }
 
         echo "
</tr>";
}
}
  echo "
</ol></table>";

}
else{
    
    echo "
<b>You have to be an active user and purchased a product for you to download the product spec sheetPlease <a href=\"/customer/account/login/\"><font style=\"color:white;text-decoration:underline;font-style:italic;\">login in</font></afirst and then come back to this page.</b>";  
}

?>

3- Still in cpanel (file manager) create a directory where your pdf files will go, in this case was “product-pdfs” and then create a file inside here called “index.html” for security reasons. Then go ahead and upload all your pdf files here, try to name your files in simple way so you can remember starting with the SKU + phrase + date.

4- Then in your magento admin go ahead and open any product for editing, in your top right click the button “create new attribute” in the attribute code write this “pdfpath” remember that you don’t need this in the search, or visible in frontend, pretty much all the properties will be “no”, for the label admin name try “PDF Path” the save it.

5- Now on any product you will have this attribute, if you have a pdf file for that product go ahead and type it in, “REMEMBER” write down exactly as how was upload it to the server, like “this-is-my-pdf-file-name.pdf” this system will automatically get this attribute and put in your download link.

6- Now go to your CMS page that you created for this from your magento admin.

Hope this helps.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

This extension will work for the issue - Product Attachments extension.

Provide customers with comprehensive information about products, such as user guides, warranties and so on, using attachment functionality.
-Unlimited number of files and various file types
-Download stats reports
-Complete multi-store support
-Manage display priority for attachments
-Nice icons for each file type to make pages more attractive

For more details, user guide and live demo please follow the link http://amasty.com/product-attachments.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
mauricioprado00
Member
 
Avatar
Total Posts:  63
Joined:  2009-03-11
Argentina
 

You can add attachments by using this module, hundreds of satisfied customer can ensure that you are choosing the right extension, remember always to look on the people reviews before buying an extension:

http://www.magentocommerce.com/magento-connect/product-attachs-1356.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

Hi!
Check this extension - Product Attachments module.

 
Magento Community Magento Community
Magento Community
Magento Community
 
poonams
Jr. Member
 
Total Posts:  4
Joined:  2013-12-25
 

To upload file to store & download file from store, you may use this PDF Manual magento extension. And, you can easily manage you store from admin panel.
http://magento.ocodewire.com/product-pdf-manual-by-ocodewire.html

 
Magento Community Magento Community
Magento Community
Magento Community
 
iVerve INC
Jr. Member
 
Avatar
Total Posts:  6
Joined:  2013-09-17
Chicago IL, USA
 

Hi,

Try below extension for upload product PDF

Upload PDF Extensiopn

Thanks..
Team I-verve Infoweb INC

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mage Solution
Sr. Member
 
Avatar
Total Posts:  179
Joined:  2013-11-12
 

it’s simple to fulfill using our Magento product video module. This extension allows you to place a video onto Magento product page. With sharing videos made easy on Youtube, just copy the iframe code and paste it into the product description. Video will be shown on the product page under the product description.
More details click : http://www.magentocommerce.com/magento-connect/mgs-product-videos.html
See homepage : http://www.magesolution.com/magento-extensions.html

Image Attachments
fontend2.jpgfontend2.jpg
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 4 of 4