Simple QrCode. generate many qr code using laravel - laravel

I would like to generate many QR code using
"Simple QrCode"
https://www.simplesoftware.io/docs/simple-qrcode
I can make one QR code like this
{!! QrCode::size(100)->generate('http://www.mywebsite.com') !!}
but how do I make alot.
I'm beginer this code looks not good. sorry.
I can make loop but loop numbers doesn't work.
<table border="1">
<?php
for ($i=1; $i<5; $i++) {
$url = "http://localhost/acex/1.php?g=". $i;
$qr = '{!! QrCode::size(100)->generate(' . $url .') !!}';
echo "link ";
echo"<br>";
?>
<tr>
<td>
<?php
echo "link ";
?>
</td>
<td>
<?php
echo $qr;
?>
</td>
<td>
<?php
echo $url;
?>
</td>
</tr>
<?php
}
?>
</table>

As you already use SimpleSoftwareIO, just write:
use SimpleSoftwareIO\QrCode\BaconQrCodeGenerator;
and put this code in your loop:
$qrcode = new BaconQrCodeGenerator;
$qrcode->size(100)->generate("your text", 'path to save file');
It worked for me.

Related

Google Sitemap grid not being filled/shown

On our Magento 1.6.2 website we have enabled Google Sitemaps and added some manually with updates through cron.
What happens now is that the page Catalog > Google Sitemap in it's filters tells us that 4 records were found.
But it doesn't show anything below the filters.
Through looking at the source code I've found that the div with class sitemapGrid only has a total height of 33px and the div with class grid that should display the sitemaps only has a total height of 7px, 6 of which are padding.
The sitemapGrid_table is 0px high, with a 1px border.
But no tr nor td.
After some more digging I've found that the file in which it all happens is design > adminhtml > default > default > template > widget > grid.phtml
The page runs till the end of the first foreach after "grid" and then stops.
<div class="grid">
<div class="hor-scroll">
<table cellspacing="0" class="data" id="<?php echo $this->getId() ?>_table">
<?php foreach ($this->getColumns() as $_column): ?>
<col <?php echo $_column->getHtmlProperty() ?> />
<?php endforeach; ?> <!-- Runs to here and then stops executing, but who knows why? -->
<?php if ($this->getHeadersVisibility() || $this->getFilterVisibility()): ?>
<thead>
<?php if ($this->getHeadersVisibility()): ?>
<tr class="headings">
<?php foreach ($this->getColumns() as $_column): ?>
<th<?php echo $_column->getHeaderHtmlProperty() ?>><span class="nobr"><?php echo $_column->getHeaderHtml() ?></span></th>
<?php endforeach; ?>
</tr>
<?php endif; ?>
<?php if ($this->getFilterVisibility()): ?>
<tr class="filter">
<?php $i=0;foreach ($this->getColumns() as $_column): ?>
<th<?php echo $_column->getHeaderHtmlProperty() ?>><?php echo $_column->getFilterHtml() ?></th>
<?php endforeach; ?>
</tr>
<?php endif ?>
</thead>
If I comment out the first foreach, the code keeps running till it ends the first foreach in "headings". And so on (comment out one, runs till end of next one, ...)
Anyone have any idea on where the problem really lies and/or a solution?
So,
Long story short:
exception.log wasn't being filled so once that was solved I got to see that Magento couldn't find a certain blocktype.
Solved an error in config.xml and it all works just fine.

Passing data to view Codeigniter

I want to pass row fetched from database to view from controller.
foreach ($usertable->result() as $note) {
$note['title'];
$this->load->view('note',$note);
}
but it didn't work.
Strictly, not the right way to send data to view (not inside for loop). This will load the view the numbers of time the loop runs.
Enclosed all the notes data into a variable say via an array data['notes'] and the now in view you can use notes variable for fetching data. Read docs for more info.
In controller:
$data['notes'] = $usertable->result();
$this->load->view('note', $data);
In view:
<table>
<tr>
<td>Note id</td>
<td>title</td>
</tr>
<?php foreach($notes as $n) { ?>
<tr>
<td><?php echo $n->id; ?></td>
<td><?php echo $n->title; ?></td>
</tr>
<?php } ?>
</table>
you can use following.
foreach ($usertable->result() as $note) {
$note[]=$note;
}
$note['title'];
$this->load->view('note',$note);

Export configurable products with ASSOCIATED Column

This is driving me crazy. No matter what export I do using profile, the column "assocciated", as mentioned in various magento guides is missing. I have around 7000 products and need to export them with the parent/child relationship intact, however, after export it just shows all the products without any columns mentioning the relationship also link for only 1 image is shown even when there are more than 5 images.
I would like to see the configurable products with all the associated products (seperated by comma) OR simple products with the sku of configurable product.
Is there any option to accomplish this?
Thanks.
U can use this code
(please make filename.php under your web root
<?php
require_once 'app/Mage.php';
Mage::app();
//$parentProduct= Mage::getModel('catalog/product')->load('2862');
$parentCollection = Mage::getResourceModel('catalog/product_collection')
->addAttributeToSelect('*')
->addAttributeToFilter('type_id','configurable')
->addAttributeToFilter('status','1');
//$pid = array();
$read= Mage::getSingleton('core/resource')->getConnection('core_read');
function getAttributeValue($value){
global $read;
$query = "select value from eav_attribute_option_value where option_id = '$value'";
$customAttributeValue = $read->fetchAll($query);
return $customAttributeValue[0]['value'];
}
?>
<style>
tr td{
border:1px solid black;
}
</style>
<table>
<thead>
<tr>
<td>sku</td>
<td>simple_skus</td>
<td>type</td>
<td>class</td>
<td>silos</td>
</tr>
</thead>
<tbody>
<?php
foreach($parentCollection as $parentID){
$parentProducts = Mage::getModel('catalog/product')->load($parentID->getId());
$childProducts = Mage::getModel('catalog/product_type_configurable')
->getUsedProducts(null,$parentProducts);
?>
<?php
foreach($childProducts as $child){
?>
<tr>
<td>
<?php echo $child->getSku();?>
</td>
<td>
<?php echo " "?>
</td>
<td>
<?php echo $child->getTypeId()?>
</td>
<td>
<?php
$value = $parentProducts->getClass();
echo getAttributeValue($value);
?>
</td>
<td>
<?php
$value = $parentProducts->getSilos();
echo getAttributeValue($value);
?>
</td>
</tr>
<?php }?>
<tr>
<td>
<?php echo $parentProducts->getSku();
?>
</td>
<td>
<?php
$separation = array();
foreach($childProducts as $child){
$separation[] = $child->getSku();
}
echo implode(',',$separation);
?>
</td>
<td>
<?php echo $parentProducts->getTypeId();?>
</td>
<td>
<?php
$value = $parentProducts->getClass();
echo getAttributeValue($value);
?>
</td>
<td>
<?php
$value = $parentProducts->getSilos();
echo getAttributeValue($value);
?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
then browser your filename.php from your website
from that list you can convert html to csv
check this
http://www.convertcsv.com/html-table-to-csv.htm
hope this help
Magento provides export and import for configurable products from System > Import/Export > Dataflow - Profiles, please see the attached image how it's exporting configurable products
Main columns to take care about are type and has option as parent product will be assigned with has_option as 1 ,visibility as catalog, seacrh and it's child products which will assigned value for has_option as 0 , visibililty as Not Visible Individually and it's related attributes values like shoe_type , shoe_size and gender
-magmi option to import configurable products which will assign Associated products to parent product.Before this import one need to first import simple and configurable products.

Problem with ajax using symfony 1.4

I have a very strange problem when I using ajax in symfony 1.4. I've used the jobeet example (day 18) but it doesn't work
This is my indexSuccess.php
<script type="text/javascript" >
$(document).ready(function(){
$('#buscador').keyup(function(key)
{
if (this.value.length >= 3 || this.value == '')
{
$('#per').load( $(this).parents('form').attr('action'),
{ query: this.value + '*' });
}
});
});
</script>
<h1>Lista de personas</h1>
<p>Busque o cree registros de personas en el sistema (Estudiantes, funcionarios, docentes).</p>
<form action="<?php echo url_for('personas/index')?>">
<table>
<tr>
<td><input type="text" name="buscar" id="buscador"/></td>
<td><img src="/images/iconos/Search.png"/></td>
</tr>
</table>
</form>
<p style="font-size: 11px;color: gray;">Digite un nombre, apellido o número de identificación para buscar</p>
<div class="per" id="per">
<?php echo include_partial('personas/buscaPersonas',array('personass'=>$personass)); ?>
</div>
The jquery script detects characters in the input, when I write 3 or more characters it should load the div with id='per'. Here is my personasAction.class.php
public function executeIndex(sfWebRequest $request)
{
$this->personass = array();
if($request->isXmlHttpRequest())
{
$this->personass = $this->getRoute()->getObjects();
return $this->renderPartial('personas/buscaPersonas', array('personass'=> $personass));
}
}
When I load the page I dont want to see any result. So, when I do a ajax call, I should reload the partial "_buscaPersonas.php" with all results (just for try), but I load the _form.php partial.
This is my partial:
<table>
<?php foreach($personass as $personas): ?>
<tr>
<td colspan="5" class="tituloTD"><?php echo $personas->getNombre(); ?></td>
</tr>
<tr>
<th>Numero identificación: </th><td><?php echo $personas->getNumeroid() ?></td>
<th>Email: </th><td><?php echo $personas->getEmail(); ?></td>
<td> <img src="/images/iconos/editar.png"/></td>
</tr>
<?php endforeach; ?>
</table>
I've trying to find where is the problem but I not get it. When I use the button for normal search it works, load the correct partial but whit ajax load other partial.
Please somebody knows what is my error.
thanks
I think this due to the path of your load ajax function:
$('#per').load( $(this).parents('form').attr('action'),
{ query: this.value + '*' });
$(this).parents('form').attr('action') is certainly a wrong value.
Try this :
url_for('personas/index')
Finally I find the error. I dont know what happen but if I send data with the load function I have and error. So I had to send the data using the url, and is works:)
if (this.value.length >= 3 || this.value == '')
{
$('#per').load( "<?php echo url_for('personas/index')?>"+"?query="+this.value);
}

Codeigniter directory_map()

I'm trying to use the directory_map('source directory',false) function to scan through user uploaded folders/files. It works and spit out the result in a multilevel array format.
I wouldn't know how deep is the multi level array would be. How do I iterate the array and display it in a readable format (e.g. in html (ol/ul) tags)?
Recursive functions, whoop!
Here is an example of a recursive function being used in one of my view files.
<tbody>
<?php function album_row($albums, $parent, $lvl) { ?>
<?php if(isset($albums[$parent])) foreach ($albums[$parent] as $album): ?>
<tr>
<td><?php echo form_checkbox('action_to[]', $album->id); ?></td>
<td><?php echo repeater('-- ', $lvl);?> <?php echo $album->title;?></td>
<td><?php echo $album->num_photos;?></td>
<td><?php echo date('M d, Y', $album->updated_on);?></td>
<td><?php echo anchor('photos/' . $album->slug, lang('photo_albums.view_label'), 'target="_blank"') . ' | ' .
anchor('admin/photos/manage/' . $album->id, lang('photo_albums.manage_label')) . ' | ' .
anchor('admin/photos/edit/' . $album->id, lang('photo_albums.edit_label')) . ' | ' .
anchor('admin/photos/delete/' . $album->id, lang('photo_albums.delete_label'), array('class'=>'confirm')); ?>
</td>
</tr>
<?php album_row($albums, $album->id, $lvl+1) ?>
<?php endforeach; }?>
<?php album_row($albums, 0, 0); ?>
</tbody>
Yours will be a little different as basically you want to create a function that checks if the content is an array or a string.
If its a string, echo. If its an array, call the same function again.

Resources