Showing posts with label joomla. Show all posts
Showing posts with label joomla. Show all posts

Tuesday, September 17, 2013

How to find all your missing or broken images in Virtuemart

If your store has changed servers or you are just having some file backup issues and are missing your images here is a quick script to tell you which images are broken in virtuemart. This php script could easily be modified for other websites, stores, or tables.

Just change a few variables, upload and it will list out all of your missing product photos. Even with an edit link to help you fix them faster!


 /**
Joomla 1.5 - virtuemart 1.9
lists product large images that are missing and need to be re-uploaded
Thumbnails are auto generated so its not an issue to look for them.
could be easily modified for other datbases/content i.e. categories

*/

//database variables - copy from your configuration.php
$user = '';
$db = '';
$password = '';
$host = 'localhost';
$editurl ='https://www.DOMAIN.com/administrator/index.php?page=product.product_form&limitstart=0&keyword=&product_parent_id=&option=com_virtuemart&product_id=';
 
//make sure you edit your full path here 
$filepath ='/home/DOMAIN/public_html/components/com_virtuemart/shop_image/product';

echo "file location:".$filepath."<br><br>";

if (!$link = mysql_connect($host, $user, $password)) {
    echo 'Could not connect to mysql';
    exit;
}

if (!mysql_select_db($db, $link)) {
    echo 'Could not select database';
    exit;
}
//database query for the fields we need
$sql    = 'SELECT product_id,product_full_image, product_name FROM jos_vm_product';
$result = mysql_query($sql, $link);

if (!$result) {
    echo "DB Error, could not query the database\n";
    echo 'MySQL Error: ' . mysql_error();
    exit;
}

while ($row = mysql_fetch_assoc($result)) 
{
    $filename = $filepath.'/'.$row['product_full_image']; 
    //output the file name and edit link if the file is missing  
    if(!file_exists($filename))
    { 
        echo $row['product_full_image']. ' - '.$row['product_name']  ;
        echo  ' <a href="'.$editurl.$row['product_id'] .'" target="_blank">edit</a><br>';
    }
}

mysql_free_result($result);
exit();
 


Stumble Upon CodePyro

Tuesday, June 19, 2012

Virtuemart Orders Report By Category

Attached is a custom add-on report for InteraMind Reports.

This report finds all of the orders within a date range and outputs the persons name, product information and the Root/Base Category from each product they ordered.

This is a handy report and allows for us to easily import these customers name & email into our preferred email marketing software.

For Example if I made an order with 2 items

Computers -> CPU -> Intel i7x
Software -> Business -> Quickbooks 2012


The resulting csv would look like 

19 June 2012, CodePyro, info@codepyro.com ,Computers
19 June 2012, CodePyro, info@codepyro.com ,Software


Download the Virtuemart Orders Report By Category InteraMind Reports


Stumble Upon CodePyro

Wednesday, May 09, 2012

Breezing Forms Emailed CSV attachment Field sort order

In the latest version of Breezing Forms the email notification with CSV attachment is an awesome feature. I really enjoy that component for joomla its incredible and makes my job much easier.

Today's request and issue that bugs me is that they sort the fields in the CSV instead of leaving them as in defined in the admin.
example
EXAM1_QUESTION1. EXAM1_QUESTION10,EXAM1_QUESTION11, EXAM1_QUESTION2

This is annoying; To Solve

Edit lines 4391 and 4401
comment out   ksort($fields);


Stumble Upon CodePyro

Thursday, January 26, 2012

Joomla Virtuemart Product search plugin not finding products

The vmxsearch.plugin that comes with Virtuemart to integrate product search into the normal joomla website search works great once its configured. Some products may not show in the search results.

The main cause for this is if the product is out of stock. In my case I had a -2 in the stock amount for the products that were not showing.

Change this by going into the admin->virtuemart->product list-> edit product and change the stock on the Product Status Tab.


Stumble Upon CodePyro

Tuesday, May 17, 2011

Customize the Joomla offline login redirect url

First off to customize the offline login form for joomla change the "Site Offline" to yes in the Global Configuration-> site tab.

Once you make this change the website will require a login to view the site. To customize this page copy the offline.php file to templates/YOURTEMPLATE folder. Then feel free to add your graphics, tweak the css and heck even add some animation from jquery or perhaps a slideshow.

For my project I needed to have a splash html page before the website login. This causes issues because the index.html page is loaded as the 'URL/' inestead of the index.php. Basically when someone logged in they would be redirected to the splash page. Well heck that ain't gonna work...

So to resolve the issue you need to find the line in the offline.php file that has the base64_encode(JURI::base()). Replace the JURI::base() with the url you need to redirect to i.e. base64_encode('http://YOURDOMAIN.com/about')


Stumble Upon CodePyro

Tuesday, May 10, 2011

Joomla website offline login issue on IIS with sh404sef

QUICK how to fix sh404sef on IIS - just in case
1. open up webroot\components\com_sh404sef\shPageRewrite.php
2. Find and replace every instance of #__sh404SEF so it matches your db table. The default is lower case #__sh404sef. OMG WTF! it works on Linux and Apache, why not windows????

Venting and Explanations
Horray! another 3 hours learning about sh404sef. This time a site needed to use the joomla website offline login form. This particular site is hosted on win IIS over at Outstanda hosting, they actually had really responsive tech support which was nice.

Support was needed to figure out how to modify folder permissions in their control panel. For reference you have to change it in the FTP manager from the control panel.

As soon as the website offline was enabled the website was throwing a "service temporarily unavailable" which is INCREDIBLY annoying to figure out, esp because this server would not output error messages. I manually stepped through the files tracing it to the shPageRewrite.php file to the first line for the db call.


Stumble Upon CodePyro

Monday, March 28, 2011

Enable HTML in joomla k2 extra fields

K2 is a wonderful CCK and content replacement for the standard joomla content. In fact I am using it with k2mart to create some awesome shopping cart goodnes. Of course the shopping cart I am converting from is a Custom CMS/E-commerce system that has tons of custom html pieces in the product buy now pages.

Specifically I needed the ability to choose several custom messages that have little html to open new windows, highlight messages etc.

There are community links for an older version of k2 here

These don't work in the latest so here is an updated working html hax for K2 v2.4.1!

Open up Administrator/components/com_k2/models/extrafield.php

//line 32 
if (!$row->bind(JRequest::get('post')))
 

//around line 53 look for 
$objects = array ();
$values = JRequest::getVar('option_value');
$names = JRequest::getVar('option_name');

Replace with the following (if you have questions see documentation)
 //line 32 - replaced
if (!$row->bind(JRequest::get('post',JREQUEST_ALLOWHTML)))


//around line 53 - replaced
$objects = array ();
$values = JRequest::getVar('option_value','','post','string',JREQUEST_ALLOWRAW);
$names = JRequest::getVar('option_name','','post','string',JREQUEST_ALLOWRAW);
 


Stumble Upon CodePyro

Tuesday, March 15, 2011

Remove modules from Virtuemart Checkout

In creating a new e-commerce site with K2 the Virtuemart checkout was showing all the homepage modules.

After reading a lot of different overly complex solutions on the forums I created this.

//add this code at the top of your template
global $option;
 
//disable modules for virtuemart checkout
 $vmpage= 0;
 if($option == 'com_virtuemart')
 {
  $vmpage= 1;
     $mainWidth = "twoL";
 }

//Then for every module position you need to turn off just add && !$vmpage
//example
if($this->countModules('right')  &&  !$vmpage ){}


Stumble Upon CodePyro

Sunday, March 13, 2011

k2mart Creating a module Product Grid

To create your product grid you will need to first setup k2mart custom listing overrides.

Once that is done create a new mod_k2_content module item and add it to your template. My grid is fairly large so it goes in the "bottom" position under the content.

Change module settings

  • Change the "Select sub-template" to your new custom override directory.
  • Select the categories or specific items, I chose categories to make it simple
  • Configure all of the things you would like to show, I turned off everything but the image; all of the items prices and names come from the k2mart plugin so we dont need any of the k2 items properties

!important: Before saving your module, make sure to enable k2 plugins under advanced in the module. Or k2mart will not load.

Now that your module is all setup we can make grid changes. Open up Template/html/mod_k2_content/CUSTOM_OVERRIDE/default.php file to alter the default list behavior. In this file you will find that the k2 items are setup in an HTML list.

Add a class of "productGrid" to the UL and "boxItem" to the LI.
//around line 20
<ul class="productGrid">
    <?php foreach ($items as $key=>$item):  
//around line 26 
<li class="<?php echo ($key%2) ? "odd" : "even"; if(count($items)==$key+1) echo ' lastItem'; ?> boxItem">

Now go adjust your template style sheets to get the list items to behave as a grid. I wanted all of my k2 items in a box format to fit 4 items per row. To do this I made each list item a block with a width and padding to ensure they would fit in 980px.
.productGrid li.boxItem
{  
    color:#D76024;     
    display:block; 
    float:left; 
    font-weight:bold;
    font-size:14px !important;
    padding:5px 20px 5px 20px;
    width:200px;
}

Now we have a grid of our products but the k2 mart product boxes are ugly. Lets go fix that too.

Open up the custom override TEMPLATE/html/k2mart/module.php
Change the module.php k2mart class from class="itemVmFields" to class="itemGrid".

To get my desired look of Product Name, then Image, then Price, I copied over the image display from the mod_k2_content file. As you can see I removed the LI item for the product name and put it into an h4 tag before the image.

//K2mart STARTS HERE
<div class="itemGrid"> 

//moved product name into h4
 <?php if($this->params->get('moduleProductName') && !empty($product->name)): ?>
         <h4 >
            <span class="itemLabel"><?php echo JText::_('Name'); ?>:</span>
            <span class="itemValue"><?php echo $product->name; ?></span>
         </h4>
<?php endif; ?>

//Image code pulled from mod_k2_content/default.php        
 <?php if(isset($item)):?>
     <div class="moduleItemIntrotext">
            <a class="moduleItemImage" href="<?php echo $item->link; ?>" title="<?php echo JText::_('Continue reading'); ?> &quot;<?php echo K2HelperUtilities::cleanHtml($item->title); ?>&quot;">
              <img src="<?php echo $item->image; ?>" alt="<?php echo $item->title; ?>"/>
          </a>
       </div>
 <?php endif;?> 
    <ul> 

Now lets play with our style sheets for the k2mart items in our grid
.itemGrid ul { margin:0px; padding:0px;}
.itemGrid ul li{ margin:0px; padding:0px; height:auto; list-style:none;}
.itemGrid h4{ color:#AAA;}

Of course then I played with buttons and text styles, but hey its a start.

Final Results:


Stumble Upon CodePyro

Sunday, March 13, 2011

K2 override k2mart templates

In Joomla and K2 with K2 mart for virtuemart it was difficult for me to find/discover how best to customize the plugin templates. It turns out to be really simple though.

Create a folder called k2mart in your templates html overrides folder. TEMPLATE/html/k2mart

Then copy the 4 files from plugins/k2/k2mart/tmpl folder into your new overrides.


Specifically I needed to change the listing plugin to build a product grid. The listing template is actually calling the module.php file.


Stumble Upon CodePyro

Wednesday, March 02, 2011

CSVI virtuemart google base export Tax's changes

Google base import has changed their tax format for product import, to implement these changes in Virtuemart CSVI export you need to make some code changes.

  1. Change the Default fields in the google base export
    1. Change the custom field g:tax_region to g:tax and give it your required values semi-colon separated in the format of (Country:Region:Rate) i.e. "US:Colorado:5.00"
  2. Remove the custom field g:tax_percent

around line 113 in csvi_class_xml_froogle.php in the file
administrator/com_csviimproved/helpers/xml
add the following case to the function ContentText


case 'g:tax':
                        list($country, $service, $rate) = split(":", $content);
                        $this->contents = '
                        <g:country>'.$country.'</g:country>
                        <g:region>'.$service.'</g:region>
                        <g:rate>'.$rate.'</g:rate>
                        <g:tax_ship>n</g:tax_ship>
                        ';
                    break;


Stumble Upon CodePyro

Wednesday, January 26, 2011

Virtuemart Google base export with Child Products

The default Google Base export in CSVI for joomla and virutmart is set as a "Product export" which does not include any child products. To include Child products you need to first change the type to "Multiple prices export".

Unfortunately though the multi prices export doesn't have all the fields for the google base export.

So I modified some files in the model to get the export working as needed. Download the files and put them in the administrator\components\com_csvimproved\model folder.

CSVIMultiPricesMods.zip


Stumble Upon CodePyro

Monday, December 20, 2010

virtuemart: Enable Billing information in Order Review page

Quick script to paste into the virtuemart checkout confirmation page to show the billing information under the shipping info.

Step 1:
Search for "if(NO_SHIPTO=='')" in your components/com_virutemart/themes/YOURTHEME/templates/checkout/get_final_confirmation.tpl.php

Step 2:
and find the last line that reads
echo "</td></tr>";


Step 3:
Just after that last line paste the below contents.

$db->query("SELECT * FROM #__{vm}_user_info WHERE user_id=".strip_tags($db->f("user_id"))." and address_type='BT'");
    $db->next_record();
 
    
    echo '<tr><td valign="top"><strong>'.$VM_LANG->_('PHPSHOP_ORDER_PRINT_CUST_BILLING_LBL') . ":</strong></td>";
    echo '<td>';
    echo vmFormatAddress( array('name' => $db->f("first_name")." ".$db->f("last_name"),
                                        'address_1' => $db->f("address_1"),
                                        'address_2' => $db->f("address_2"),
                                        'state' => $db->f("state"),
                                        'zip' => $db->f("zip"),
                                        'city' => $db->f("city"),
                                        'country' => $db->f('country')
                                    ), true );
    
    echo "</td></tr>";



Stumble Upon CodePyro

Thursday, October 07, 2010

JUser::_load: Unable to load user with id

In joomla or k2 you may receive this error "JUser::_load: Unable to load user with id". Guess what, a user with that id was deleted and the error shows because some piece of content is trying to load that user account. In my case it was being thrown from k2 comments because the user had commented on the blog post had been deleted.

To resolve this create an empty user in the admin of joomla and change its ID to the missing one in phpmyadmin.

OR

You can just delete the users stuff.. i.e. comments photo etc from k2 or joomla.


Stumble Upon CodePyro

Thursday, August 26, 2010

k2 how to show comments on latestitem or category

If your here you are wondering how the heck am i able to show the comments section for a K2 item in either the latestitem or category template.

For starters you need to create a customized template override by placing a copy of
components/com_k2/templates into /templates/[YOUR TEMPLATE]/html/com_k2/.
Note: notice there will not be a templates folder in your custom html/com_k2. The template files go directly into the com_k2 folder!
More details on templates

I am using a menu item to pull k2 content, which doesn't show you the menu for selecting a sub-template. Basically this requires you to edit the template in the Default folder.

Now go ahead and edit the /templates/[YOUR TEMPLATE]/html/com_k2/latest_item.php. Find the line that says...

<?php echo $this->item->event->K2AfterDisplay; ?>

Now paste the following code just after that line.

<?php 
     //you can set the limit start by using pagination; we only needed the top 3 comments
  //look at line 143 of /components/com_k2/views/item/view.html.php
  $limitstart =0;
  $limit = 3;
  //get the comments array
  $comments = K2ModelItem::getItemComments($this->item->id, $limitstart, $limit);
   $this->item->comments = $comments; 
  ?>
  
  <?php if($this->item->params->get('itemComments') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1'))):?>
  <!-- K2 Plugins: K2CommentsBlock -->
  <?php echo $this->item->event->K2CommentsBlock; ?>
  <?php endif;?>

 <?php if($this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock)):?>
  <!-- Item comments -->
  <a name="itemCommentsAnchor" id="itemCommentsAnchor"></a>

  <div class="itemComments">

   <?php if($this->item->comments): ?>
  

   <ul class="itemCommentsList">
     <?php foreach ($this->item->comments as $key=>$comment): ?>
   <li class="<?php echo ($key%2) ? "odd" : "even"; echo (!$this->item->created_by_alias && $comment->userID==$this->item->created_by) ? " authorResponse" : ""; ?>">
 
    <span class="commentLink">
     <a href="<?php echo $this->item->link; ?>#comment<?php echo $comment->id; ?>" name="comment<?php echo $comment->id; ?>" id="comment<?php echo $comment->id; ?>">
      <?php echo JText::_('Comment Link'); ?>
     </a>
    </span>
 
     <?php if($comment->userImage):?>
     <img src="<?php echo $comment->userImage; ?>" alt="<?php echo $comment->userName; ?>" width="<?php echo $this->item->params->get('commenterImgWidth'); ?>" />
     <?php endif; ?>
 
     <span class="commentDate">
     <?php echo JHTML::_('date', $comment->commentDate, JText::_('DATE_FORMAT_LC2')); ?>
    </span>
 
    <span class="commentAuthorName">
     <?php echo JText::_("posted by"); ?>
     <?php if(!empty($comment->userLink)): ?>
     <a href="<?php echo $comment->userLink; ?>" title="<?php echo $comment->userName; ?>" target="_blank" rel="nofollow">
      <?php echo $comment->userName; ?>
     </a>
     <?php else: ?>
     <?php echo $comment->userName; ?>
     <?php endif; ?>
    </span>
 
    <p><?php echo $comment->commentText; ?></p>
 
     <div class="clr"></div>
   </li>
   <?php endforeach; ?>
    </ul>
 
  <?php endif; ?>
 

   <?php $user = &JFactory::getUser(); if ($this->item->params->get('comments') == '2' && $user->guest):?>
<!--     <div>
   <a href="<?php echo $this->item->link.'#itemCommentsAnchor'; ?>" title="<?php if(!empty($this->item->image_caption)) echo $this->item->image_caption; else echo $this->item->title; ?>">
   <?php echo JText::_('Login to post comments');?></a></div>-->
   
   <div class="s5box_login cboxelement"><a href="#"><?php echo JText::_('Login to post comments');?></a></div>
   <?php endif; ?>

  </div>
  <?php endif; ?>
 



If your interested the magic comes from the call to the K2ModelItem::getItemComments function. It actually retrieves the Comments array since it is not included in the Categories nor latest item. The Comments display code came directly from the item.php in the templates. Take a look at it if you need to add other functionality!


Stumble Upon CodePyro

Wednesday, August 25, 2010

joomla feedburner email signup module

Just a simple module so you can setup the feedburner Email form signup. It would be easy to add the RSS link as well.

mod_feedburner


Stumble Upon CodePyro

Sunday, August 15, 2010

Modalizer show hidden DIV in joomla

If you need to show a hidden div in joomla using modalizer, i have the hack for you!.

Unfortunatly the mootools squeezebox script that comes with modalizer is different than normal joomla 1.5 squeezebox. Yep thats right the developers skipped the "adopt" feature that the normal squeezebox has, so I added it!

Here is an example of how to set it up.
First download my hacked version of nn_squeezebox.js, extract and copy it to "\plugins\system\modalizer\modals\squeezebox"

<a   class="nn_squeezebox" rel="{handler: 'adopt', adopt: 'test',size:{x: 650, y: 500}}" >test</a>

<div id="test" style="display:none">YEA!!! it works</div>


DOWNLOAD fixed nn_squeezebox.js

NOTE: For some reason all the ID attributes get stripped from the code in the hidden div when displayed in the popup, so make them classes!


Stumble Upon CodePyro

Tuesday, April 06, 2010

FedEx Handling fee as a percent in virtuemart

If your like me, and every client needs something special and different. One of my latest e-commerce stores used FedEx for shipping. Great, no problem its an easy setup in Virtuemart. Their FedEx account gives them special pricing for the online shipping calculator, which they need to add 40% too. Virtuemart doesn't allow you to add a percent only a set integer amount.

The handling fee variable in virtuemart is setup only to add a base amount to the shipping cost. We needed to add 40% to each shipping amount.

This is a change specifically for FedEx, but the other shippers should be similar.

Change the handling fee in the FedEx preferences to 0.40.

components/com_virtuemart/classes/shipping/fedex.php: around line 206
change & add the lines below.

//add the percent or set amount 
if(FEDEX_HANDLINGFEE < 1)
     $charge =$rate_Ret['1419-'.$i]+ $rate_Ret['1419-'.$i] * floatval( FEDEX_HANDLINGFEE );
    else
     $charge = $rate_Ret['1419-'.$i] + floatval( FEDEX_HANDLINGFEE );


Stumble Upon CodePyro

Tuesday, March 30, 2010

Joomla Administrator force SSL login loop FIX

It took me A LONG time to find a solution on how to fix this problem. All credit for this fix goes to member:jptkts from http://forum.joomla.org.

This fixes the login loop issue when trying to login to the admin after making the Force_SSL to 1 or Administrator.

His original forum post is
http://forum.joomla.org/viewtopic.php?p=1619969#p1619969

I just wanted to re-post it in an easy to find place!

In the file: Joomlaroot/libraries/joomla/environment/uri.php
starting on line 214 replace this if statement:
Code:
if(JPATH_BASE == JPATH_ADMINISTRATOR) {
   $base['path'] .= '/administrator';
}

with the following:
Code:
if(JPATH_BASE == JPATH_ADMINISTRATOR) {
   $force_ssl = $config->getValue('config.force_ssl');
   if($force_ssl > 0){
      $base['prefix'] = ereg_replace("http://","https://",$base['prefix']);
   }
   $base['path'] .= '/administrator';
}


Stumble Upon CodePyro

Thursday, March 25, 2010

virtuemart google analytics with ppc

Good morning today we needed to add google analytics to a virtuemart joomla store. Heres how we done it.

Over on joomlacode.org Matthieu Barbe did a great job of creating a google analytics plugin. His plugin will work on every page. It shows the generic google analytics code for normal pages and for the shopping cart finish/confirmation will track a users order, price, items etc.

Visit joomlacode.org to download the original mod_gavirtuemart.

I have requested to join the project, but until that goes through ill post my modifications to the module here.

The module had a bug in several queries with user_info_id using the default or wrong id when a different shipping address is used.

Our SEO consultant Scott Orth for this project recommended setting up google PPC conversion code. To make life easy I added some settings and template for ppc.php to show only on the order thank you/confirmation page.

This is one of my first actual joomla module posts so let me know if it works, or doesn't.
mod_gavirtuemart w ppc


Stumble Upon CodePyro