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

Frustrating inconsistencies with the Admin area
 
tilzinger
Sr. Member
 
Total Posts:  126
Joined:  2007-12-27
 

If I go to Sales > Shipments, select a number of orders, then change the action to PDF Packingslips it ends up calling class: Mage_Sales_Model_Order_Pdf_Shipment method: getPdf, but if I go to Sales > Orders and change the action to Print Packingslips, it ALSO goes to that same class/method.

I’ve modified the getPdf method to print only the addresses of the orders in a 2 column x 5 rows grid so my client can print multiple addresses on a single sheet of shipping labels. If I go to the Sales > Shipments > PDF Packingslips it prints a PDF exactly how I want with the rows and columns, but if I go to Sales > Orders > Print Packingslips it prints a single address per PDF page.

How is this possible if they’re BOTH calling the same class/method but apparently sending the data differently??? Also, why can’t the labeling be the same between the two pages? Pick either PDF Packingslips, or Print Packingslips, don’t change the wording when they both do the same thing.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tilzinger
Sr. Member
 
Total Posts:  126
Joined:  2007-12-27
 

The two methods in question. Nearly identical, but called the same, and working just differently enough to be annoying. If they do the same thing.... don’t duplicate them.

index.php/admin/sales_order/pdfshipments/key/f2e89d78335592318fb0fd905a968183/

public function pdfshipmentsAction(){
    $orderIds 
$this->getRequest()->getPost('order_ids');
    
$flag false;
    if (!empty(
$orderIds)) {
        
foreach ($orderIds as $orderId{
            $order 
Mage::getModel('sales/order')->load($orderId);
            
$shipments Mage::getResourceModel('sales/order_shipment_collection')
                ->
addAttributeToSelect('*')
                ->
setOrderFilter($orderId)
                ->
load();
            if (
$shipments->getSize()) {
                $flag 
true;
                if (!isset(
$pdf)){
                    $pdf 
Mage::getModel('sales/order_pdf_shipment')->getPdf($shipments);
                
else {
                    $pages 
Mage::getModel('sales/order_pdf_shipment')->getPdf($shipments);
                    
$pdf->pages array_merge ($pdf->pages$pages->pages);
                
}
            }
        }
        
if ($flag{
            
return $this->_prepareDownloadResponse('packingslip'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf'$pdf->render(), 'application/pdf');
        
else {
            $this
->_getSession()->addError($this->__('There are no printable documents related to selected orders'));
            
$this->_redirect('*/*/');
        
}
    }
    $this
->_redirect('*/*/');
}

index.php/admin/sales_shipment/pdfshipments/key/f70d12490ff360425374778925489e21/

public function pdfshipmentsAction(){
    $shipmentIds 
$this->getRequest()->getPost('shipment_ids');
    if (!empty(
$shipmentIds)) {
        $shipments 
Mage::getResourceModel('sales/order_shipment_collection')
            ->
addAttributeToSelect('*')
            ->
addAttributeToFilter('entity_id', array('in' => $shipmentIds))
            ->
load();
        if (!isset(
$pdf)){
            $pdf 
Mage::getModel('sales/order_pdf_shipment')->getPdf($shipments);
        
else {
            $pages 
Mage::getModel('sales/order_pdf_shipment')->getPdf($shipments);
            
$pdf->pages array_merge ($pdf->pages$pages->pages);
        
}

        
return $this->_prepareDownloadResponse('packingslip'.Mage::getSingleton('core/date')->date('Y-m-d_H-i-s').'.pdf'$pdf->render(), 'application/pdf');
    
}
    $this
->_redirect('*/*/');
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
tilzinger
Sr. Member
 
Total Posts:  126
Joined:  2007-12-27
 

I’m so shocked that no one has responded, let alone anyone from Varien.

</sarcasm>

 
Magento Community Magento Community
Magento Community
Magento Community
 
tilzinger
Sr. Member
 
Total Posts:  126
Joined:  2007-12-27
 

I just realized why the support here completely sucks ass. I haven’t paid $8900 for the Enterprise edition. Even though you’re offering a free solution, perhaps offering some sort of decent message board support would be something to consider. Maybe I’m spoiled by the awesome support over at the ExpressionEngine forums, even if I’m using the free version. Rarely, if ever, does a forum post go completely ignored, and company representatives post often.

I know I’m not the first person to complain about the utter lack of decent support here in the forums. Even if I had $8900 for the Enterprise edition, in no way would I pay for it knowing what I know now. If you’re hoping to turn some of these community edition users into enterprise edition users, then you’re sorely mistaken, especially at that price and the impression you’re leaving on the message boards.

Varien, you need to actively offer support on the message boards. Don’t think just because this single thread of mine hasn’t gotten responses that I’m complaining just to complain. This isn’t the first time this has happened to me, or anyone else.

 
Magento Community Magento Community
Magento Community
Magento Community
 
FOOMAN
Guru
 
Avatar
Total Posts:  669
Joined:  2007-12-13
Auckland, New Zealand
 

hi tilzinger,

I do agree that the PDF creation is more complicated than it should be. Here is my try and at an explanation:

The getPdf method works on shipments only. This is important because orders can have multiple shipments. This also explains the slight difference in the two methods you posted.

In the first example you send orderIds (with potential multiple shipments attached to each) to the controller.

$orderIds $this->getRequest()->getPost('order_ids');
Since the function loops over the orders it creates one page per order. To trial this you could create an order containing many different shipments. These should all end up on the same page.

In the second case you send shipmentIds to the controller

$shipmentIds $this->getRequest()->getPost('shipment_ids');

The second method could probably be simplified to not include the !isset($pdf) if clause.

ps It is obvious that Varien doesn’t frequent these boards too often any more but you should moderate your language if you expect anyone to help you out in the future

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top