| @@ -1,17 +1,34 @@ | ||
| 1 | -<?php | |
| 2 | -function sc_direct_intoCart($atts) { | |
| 3 | - global $usces; | |
| 4 | - extract(shortcode_atts(array( | |
| 5 | - 'item' => '', | |
| 6 | - 'sku' => '', | |
| 7 | - 'value' => NULL, | |
| 8 | - 'options' => NULL, | |
| 9 | - ), $atts)); | |
| 10 | - | |
| 11 | - if( WCUtils::is_blank($item) || WCUtils::is_blank($sku) ) return ''; | |
| 12 | - | |
| 13 | - $post_id = $usces->get_ID_byItemName($item); | |
| 14 | - | |
| 15 | - return usces_direct_intoCart($post_id, $sku, true, $value, $options, 'return'); | |
| 16 | -} | |
| 17 | -?> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Shortcode. | |
| 4 | + * | |
| 5 | + * @package Welcart | |
| 6 | + */ | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Direct into cart. | |
| 10 | + * | |
| 11 | + * @param array $atts Attributes. | |
| 12 | + * @return usces_direct_intoCart | |
| 13 | + */ | |
| 14 | +function sc_direct_intoCart( $atts ) { | |
| 15 | + global $usces; | |
| 16 | + extract( | |
| 17 | + shortcode_atts( | |
| 18 | + array( | |
| 19 | + 'item' => '', | |
| 20 | + 'sku' => '', | |
| 21 | + 'value' => null, | |
| 22 | + 'options' => null, | |
| 23 | + ), | |
| 24 | + $atts | |
| 25 | + ) | |
| 26 | + ); | |
| 27 | + | |
| 28 | + if ( WCUtils::is_blank( $item ) || WCUtils::is_blank( $sku ) ) { | |
| 29 | + return ''; | |
| 30 | + } | |
| 31 | + $post_id = $usces->get_ID_byItemName( $item ); | |
| 32 | + | |
| 33 | + return usces_direct_intoCart( $post_id, $sku, true, $value, $options, 'return' ); | |
| 34 | +} | |