This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// for example node type = product_display | |
$type = 'product_display'; | |
$nodes = node_load_multiple(array(), array('type' => $type)); | |
foreach ($nodes as $node){ | |
$title = $node->title; | |
print $title; | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$form_id | |
= commerce_cart_add_to_cart_form_id(array($product->product_id)); | |
$line_item = commerce_product_line_item_new($product); | |
$line_item->data['context']['product_ids'] = array($product->product_id); | |
$form = drupal_get_form($form_id, $line_item); | |
// render your $form somewhere | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$current_url = 'http://' .$_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
var userName2 = 'Переменная'; | |
</script> | |
<?php | |
if (isset($_GET['u_name'])) | |
{ | |
echo "Значение JavaScript-переменной: ". $_GET['u_name']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$form_idp= commerce_cart_add_to_cart_form_id(array(7)); | |
//in this case product_id of 7 corresponds to a silver level | |
$productp = commerce_product_load(7); | |
$line_itemp = commerce_product_line_item_new($productp, 1); // 1 is quantity | |
$line_itemp->data['context']['product_ids'] = array(7); | |
$formp = drupal_get_form($form_idp, $line_itemp); | |
<?print drupal_render($formp);?> | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ($node->field_product['und'] as $key => $product_array) { | |
if ( !empty($product_array) ) { | |
$product = commerce_product_load($product_array['product_id']); | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
foreach ($node->field_product['und'] as $key => $product_array) { | |
if ( !empty($product_array) ) { | |
$product = commerce_product_load($product_array['product_id']); | |
$largeimg = image_style_url('large', $product->field_image['und'][0]['uri']); | |
echo $largeimg; | |
} | |
} | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php print $node->nid; ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$node = node_load(49); | |
$largeimg = image_style_url('medium', $node->field_image['und'][0]['uri']); | |
echo $largeimg; | |
?>"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$products = entity_load('commerce_product'); | |
foreach ($products as $product) { | |
$title = $product->title; | |
$cokol = field_get_items('commerce_product', $product, 'field_cokol'); | |
$cokolname = field_view_value('commerce_product', $product, 'field_cokol', $cokol[0], array( | |
'type' => 'text', | |
)); | |
?> | |
<?php print render($cokolname);?> |