Blogs

Add Products to Ubercart Hack

Here's a little hack that will enable you to add products to Ubercart by passing an array of product ID's and quantity of each product specified. Relies solely on the uc_cart_add_item(); function. Works great in content nodes that you've enabled PHP input on.


<?php
if(!empty($_POST['products'])){
$products = $_POST['products'];

foreach($products as $product){
if($product['qty'] != 0){

$pid = $product['pid'];
$qty = $product['qty'];

//uc_cart_add_item(2, 3);
}
}
}
?>

Useful Linux Commands

A growing list of commands that are helpful to the new Linux user. If there are commands that you would like to see added to the list, post them in the comments and I'll be sure to put them on the list.

Operation Command
Return information about an SSL certificate. # openssl s_client -connect servername:443
Stop, Start or Restart Apache. # /etc/init.d/apache2 stop