Friday, 31 January 2014

Joomla Mijoshop Download Folders

With larger downloads you'll need to FTP them in; as doing them through Mijoshop crashes.  Here's the folder you need to upload them to.

components/com_mijoshop/opencart/download/

After this all you need to do is enter the filename in when 'inserting' your download into Mijoshop.

Tuesday, 28 January 2014

Joomla 3.2 moving things from model, controller to View.

If you've used other frameworks then one thing that might be a little confusing is how things are passed though the MVC design in Joomla.

It may make things much easier to get your head around once you appreciate the page /view/view_html.php is basically a mini-controller page.  

I for example had been putting controller in the Components controller and then calling it up with something like.

 ProductMapperController::sendToFile($xmlOutput);

by putting it in the view_html.php  then I can call it up with

$this->sendToFile($xmlOutput);


There's a bit more on this at Joomla MVC differences



Joomla Component Template for Database Queries Component

It's just occurred to me that the stage I'm at with a current Joomla 3.2 component.  That will be dealing with Transfer content across table; is at this early stage a pretty good template for any future Joomla 3.2 component for dealing with database queries in any way. 

So if you've a similar project then here's what I have.  Joomla 3.2 Database Queries Template Component

fix strict standards issues in Joomla Component development

While developing a Joomla Component I was getting this issue. 

Strict Standards: Only variables should be assigned by reference in * on line * Strict Standards: Only variables should be assigned by reference in /* on line * Notice: Undefined variable: items in * on line *

In my case this was due to using old Joomla Component rules that now with Joomla 3.2 need updating.

Take a look at this basic principle of passing values through MVC in a Joomla Component.

The Model .  com_urcomp/models/preview.php
defined('_JEXEC') or die;

class Vm2mijoModelPreview extends JModelList
{
 
 /* lets go and get all the details from MySql and then we'll deal with the array in the view */ 

  public function getVirtuemartCategory(){
      $db = &JFactory::getDBO();
      $query  = "select ";
      $query .= "* ";
   // new xref table for product/categories is #__virtuemart_product_categories
      $query .= "from #__virtuemart_categories as jvc ";
     $query .= "LEFT JOIN #__virtuemart_categories_en_gb as jvcgb ON jvc.virtuemart_category_id=jvcgb.virtuemart_category_id ";
  $query .= "LEFT JOIN #__virtuemart_category_medias as jvcm ON jvc.virtuemart_category_id=jvcm.virtuemart_category_id ";
      $db->setQuery($query);
      $row = $db->loadObjectList();
      return $row;
    }
 
 public function getGreeting()
 {
 return 'Hello, World!';
 }

}  
The View.html.php views/preview/view.html.php

defined('_JEXEC') or die;

class Vm2mijoViewPreview extends JViewLegacy
{
   function display($tpl = null) 
        {
  $model = $this->getModel();
  
  
  $greeting = $model->getGreeting();
  $this->assignRef('greeting', $greeting);
  
                          // Display the view
                parent::display($tpl);
        }
}


views/preview/tmpl/default.php


 defined('_JEXEC') or die;

// No direct access to this file
defined('_JEXEC') or die('Restricted Access');
 

echo $this->greeting;  


The error I was having was being caused on the line

$model = $this->getModel();

which I had as


$model = &$this->getModel();

Wednesday, 22 January 2014

Mijoshop downloads going to 'file not found http://*/index.php/*/account/download/download?order_download_id=*

Here's the Issue.  I have Joomla 3.2.0 installed with Mijoshop 2.2.1

When my customers order downloads after clicking on the download box I then get the following message



file not found http://*/index.php/*/account/download/download?order_download_id=*

After some testing it is apparent that when I set up a small download then this was fine.  The breaking point being at about 120MB before it stops working.

After some research I found this post http://forum.opencart.com/viewtopic.php?t=3310 . This is our PHP Info http://www.rubydance.com.au/rdtst/phpinfo.php  

which is for Open Cart. 

so I added these values to the php.ini

upload_max_filesize = 390M ;
post_max_size = 400M ;
memory_limit = 640M ;

max_input_time = 3600;

This didn't work but with some help from my hosts HeartInternet  they suggested adding this to .htaccess

RLimitMem max

The downloads now work on the installations.

Cornwall Joomla Development


Tuesday, 21 January 2014

Joomla 2.5 export Mysql error - ERROR * at line * Duplicate entry '*' for key 'idx_link_old'

When transferring the MySql database for Joomla 2.5 I am getting this message.

ERROR * at line * Duplicate entry '*' for key 'idx_link_old' 

After a Google search I found this . Relating to doing this through Command Line Database Transfer

if you are using the command line   just ad -f or --force to your import


However if you're not using command line I found that replacing my 'INSERT' commands for 'INSERT IGNORE' commands in the .sql file does the same thing.

Joomla Development Cornwall

Monday, 20 January 2014

Joomla Mijoshop - Swap customer email address for email links.

At first I was going to write my own Plugin for this but got into some problems with using event triggers of someone elses component ( Mijo shop ) .

Luckily I found the following Component; which after some thought on it's application I could manipulate into doing what I needed it to . 
The  component to install is ReReplacer

I did have a conundrum involving how I would only effect the Customer Email page that I wanted.  As just using a Regular Expression to replace the emails was causing me issue in the Admin area; where I had emails in input areas. 

The way I solved this was to amend the HTML output to add a 'span' wrapper with unique class. 

To do this OPEN components/com_mijoshop/opencart/admin/view/template/sale/customer_list.tpl

AND on line 119 add



 
Around the Customer Email call up.

THEN go to your Joomla Administration.

>  Admin > Components >  'NoNumber ReReplacer'

Then click on 'New'

Give the item a title like 'Email Swap'


ADD this in SEARCH
  (?<=\)(.*\n?)(?=\<\/span\>)


ADD this in REPLACE
\1
 
 
And make sure 'Regular Expressions', 'Case Sensitive' and 'Published' are set to YES

And  'Use 'newline' modifier' and 'Thorough' set to NO

>>then click on the 'Search Areas' tab at the top.

Enable in area = Body (not head)
Enable in feeds = No

Enable in Admin = Yes.

And that should do it.


joomla development