Monthly Archives: junio, 2012

Cómo crear un custom layout en Magento

junio 15th, 2012 Posted by magento 0 thoughts on “Cómo crear un custom layout en Magento”
  1. Copiar app/code/core/Mage/Page/etc/config.xml en app/code/local/Mage/Page/etc/config.xml.
  2. Hay que registrar el custom layout agregando un nuevo archivo en app/etc/modules, por ejemplo Mage_Local.xml
  3. En este archivo poner el siguiente código:
    <config>
    <modules>
    <mage_page> //relates to file structure
    <active>true</active> //set to active
    <codepool>local</codepool> //tell which folder to look in
    <depends> //requires the mage core
    <mage_core>
    </mage_core>
    </depends>
    </mage_page>
    </modules>
    </config>
  4. Ahora hay que crear el archivo del template. Por ejemplo copiar 3columns.phtml (en app/design/frontend/your_package/your_theme/template/page), y ponerle otro nombre por ejemplo 4columns.phtml
  5. Finalmente hay que resgutrar este nuevo template en el archivo config.xml creado en el paso 1 agregando el layout a la lista. Por ejemplo:

    <four_columns module="page" translate="label">
    <label>4 columns</label>
    <template>page/4columns.phtml</template>
    <layout_handle>page_four_columns</layout_handle>
    </four_columns>

Cómo configurar las reglas de IVA para España en Magento

junio 15th, 2012 Posted by magento 0 thoughts on “Cómo configurar las reglas de IVA para España en Magento”

1. Hay que ir a Ventas > Impuestos > Clases de impuestos al cliente y cambiarle el nombre a la regla “Retail customer” por “Cliente final”.

2. Ir a Ventas > Impuestos > Clases de impuestos al producto y crear la clase “IVA”.

3. Ir a Ventas > Impuestos > Gestionar las zonas de impuestos & tasas y crear las reglas que correspondan por ejemplo:

4. Ir a Ventas > Impuestos > Gestionar las reglas de impuestos y crear una nueva regla de impuestos. Por ejemplo:

Nombre: IVA
Clase de Impuesto al cliente: Cliente Final
Clase de Impuesto al producto: IVA
Tasa del Impuesto: seleccionar todas las que apliquen.
Prioridad: 1
Clasificación del pedido: 1   

Cómo comprimir un archivo en CentOS por consola

junio 14th, 2012 Posted by centos, linux 0 thoughts on “Cómo comprimir un archivo en CentOS por consola”

Primero hay que crear un tar con los archivos que se quieren comprimir, por ejemplo si se quiere comprimir el directorio mi_directorio:

# tar -cvf nombre.tar mi_directorio

Y luego hay que comprimir este archivo tar:

# gzip nombre.tar

Cómo eliminar todas las ordenes de prueba en Magento 1.4.2.

junio 7th, 2012 Posted by magento, php, sql 0 thoughts on “Cómo eliminar todas las ordenes de prueba en Magento 1.4.2.”

Para eliminar todas las órdenes de prueba de un site Magento (testeado en la versión 1.4.2) lanzar el siguiente query: 

 

SET FOREIGN_KEY_CHECKS = 0;

-- TRUNCATE TABLES
TRUNCATE `sales_flat_order`;
TRUNCATE `sales_billing_agreement`;
TRUNCATE `sales_billing_agreement_order`;
TRUNCATE `sales_flat_order_status_history`;
TRUNCATE `sales_flat_order_payment`;
TRUNCATE `sales_flat_quote`;
TRUNCATE `sales_flat_quote_address`;
TRUNCATE `sales_flat_quote_address_item`;
TRUNCATE `sales_flat_quote_payment`;
TRUNCATE `sales_flat_quote_shipping_rate`;
TRUNCATE `sales_flat_shipment`;
TRUNCATE `sales_flat_shipment_comment`;
TRUNCATE `sales_flat_shipment_grid`;
TRUNCATE `sales_flat_shipment_item`;
TRUNCATE `sales_flat_shipment_track`;
TRUNCATE `sales_flat_quote_item`;
TRUNCATE `sales_flat_quote_item_option`;
TRUNCATE `sales_flat_order_grid`;
TRUNCATE `sales_flat_order_item`;
TRUNCATE `sales_flat_order_address`;
TRUNCATE `sales_flat_invoice`;
TRUNCATE `sales_flat_invoice_grid`;
TRUNCATE `sales_flat_invoice_item`;
TRUNCATE `sales_flat_invoice_comment`;
TRUNCATE `sales_invoiced_aggregated`;
TRUNCATE `sales_invoiced_aggregated_order`;
TRUNCATE `sales_order_aggregated_created`;
TRUNCATE `sales_order_tax`;
TRUNCATE `sales_flat_creditmemo`;
TRUNCATE `sales_flat_creditmemo_comment`;
TRUNCATE `sales_flat_creditmemo_grid`;
TRUNCATE `sales_flat_creditmemo_item`;
TRUNCATE `sales_payment_transaction`;
TRUNCATE `sales_recurring_profile`;
TRUNCATE `sales_recurring_profile_order`;
TRUNCATE `sales_refunded_aggregated`;
TRUNCATE `sales_refunded_aggregated_order`;
TRUNCATE `sales_shipping_aggregated`;
TRUNCATE `sales_shipping_aggregated_order`;
TRUNCATE `sales_bestsellers_aggregated_daily`;
TRUNCATE `sales_bestsellers_aggregated_monthly`;
TRUNCATE `sales_bestsellers_aggregated_yearly`;
TRUNCATE `sendfriend_log`;
TRUNCATE `tag`;
TRUNCATE `tag_relation`;
TRUNCATE `tag_summary`;
TRUNCATE `wishlist`;
TRUNCATE `log_quote`;
TRUNCATE `report_event`;


-- RESET AUTOINCREMENT TO 1
ALTER TABLE `sales_flat_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_billing_agreement` AUTO_INCREMENT=1;
ALTER TABLE `sales_billing_agreement_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_status_history` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_payment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_shipping_rate` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_shipment_track` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_order_address` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_invoice_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated` AUTO_INCREMENT=1;
ALTER TABLE `sales_invoiced_aggregated_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_aggregated_created` AUTO_INCREMENT=1;
ALTER TABLE `sales_order_tax` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_comment` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_grid` AUTO_INCREMENT=1;
ALTER TABLE `sales_flat_creditmemo_item` AUTO_INCREMENT=1;
ALTER TABLE `sales_payment_transaction` AUTO_INCREMENT=1;
ALTER TABLE `sales_recurring_profile` AUTO_INCREMENT=1;
ALTER TABLE `sales_recurring_profile_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_refunded_aggregated` AUTO_INCREMENT=1;
ALTER TABLE `sales_refunded_aggregated_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_shipping_aggregated` AUTO_INCREMENT=1;
ALTER TABLE `sales_shipping_aggregated_order` AUTO_INCREMENT=1;
ALTER TABLE `sales_bestsellers_aggregated_daily` AUTO_INCREMENT=1;
ALTER TABLE `sales_bestsellers_aggregated_monthly` AUTO_INCREMENT=1;
ALTER TABLE `sales_bestsellers_aggregated_yearly` AUTO_INCREMENT=1;
ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1;
ALTER TABLE `tag` AUTO_INCREMENT=1;
ALTER TABLE `tag_relation` AUTO_INCREMENT=1;
ALTER TABLE `tag_summary` AUTO_INCREMENT=1;
ALTER TABLE `wishlist` AUTO_INCREMENT=1;
ALTER TABLE `log_quote` AUTO_INCREMENT=1;
ALTER TABLE `report_event` AUTO_INCREMENT=1;


-- RESET STORE ID COUNTERS
TRUNCATE `eav_entity_store`;
ALTER TABLE `eav_entity_store` AUTO_INCREMENT=1;

SET FOREIGN_KEY_CHECKS = 1;

Cómo saber a qué fila de un UITableViewCell pertenece un UIButton

junio 7th, 2012 Posted by ios, objective 0 thoughts on “Cómo saber a qué fila de un UITableViewCell pertenece un UIButton”

Si necesitás saber a qué fila pertenece un UIButton en el cual se hizo click se puede obtener con el siguiente código:

 


- (void)buttonPressed:(id)sender {
UIButton *button = (UIButton*)sender;
UITableViewCell *cell = (UITableViewCell *)button.superview;
NSIndexPath *indexPath = [self.table indexPathForCell:cell];

NSLog(@"Row: %d", indexPath.row);
}

Cómo reproducir un video en loop en Objective C (iOS)

junio 5th, 2012 Posted by ios, objective-c 0 thoughts on “Cómo reproducir un video en loop en Objective C (iOS)”

Sólo hay que agregar la siguiente línea:

 


// se crea el controller
MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:url];

// se le indica para que reproduzca el video en loop
mp.repeatMode = MPMovieRepeatModeOne;

Cómo reproducir video a pantalla completa en iOS 5

junio 5th, 2012 Posted by ios, objective-c 0 thoughts on “Cómo reproducir video a pantalla completa en iOS 5”

1. Crear un proyecto en XCode, Single View Application.

2. En el .h del ViewController crear la siguiente propiedad de tipo strong.

@property (nonatomic, retain) MPMoviePlayerController *player;

3. Poner el siguiente código en el método viewDidLoad del .h del ViewController:

- (void)viewDidLoad
{
[super viewDidLoad];

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"video" ofType:@"mp4"]];

// Do any additional setup after loading the view from its nib.

MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] initWithContentURL:url];
// the frame is the size of the video on the view
mp.controlStyle = MPMovieControlStyleNone;
mp.repeatMode = MPMovieRepeatModeOne;
mp.view.frame = CGRectMake(0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height);
self.player = mp;
[self.view addSubview:self.player.view];
[self.player prepareToPlay];

// tell the movie to play
[self.player play];
}

No funciona mysql en MAMP

junio 2nd, 2012 Posted by mamp, mysql, osx 0 thoughts on “No funciona mysql en MAMP”
120602 19:03:19  InnoDB: Waiting for the background threads to start
120602 19:03:20 InnoDB: 1.1.5 started; log sequence number 2155602691
120602 19:03:20 [ERROR] /Applications/MAMP/Library/bin/mysqld: unknown option ‘–skip-locking’
120602 19:03:20 [ERROR] Aborting
120602 19:03:20  InnoDB: Starting shutdown…
120602 19:03:21  InnoDB: Shutdown completed; log sequence number 2155602691
120602 19:03:21 [Note] /Applications/MAMP/Library/bin/mysqld: Shutdown complete
120602 19:03:21 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

Luego de estar googleando una hora sin sentido encontré que en /etc tenía un my.cnf que estaba levantando MAMP y por lo cual daba problemas. Renombré dicho archivo a my-cnf y solved!

Copyright © 2018 programadorfreelanceargentina.com

Programador Freelance Argentina