April 16, 2016 in Technical Problems
My site currently uses 3.x and Nexus to sell themes, however instead of using the Nexus storefront to browse products, I've coded my own external php pages (not integrated with IP.Board). A visitor simply clicks the green "Download" link on my website, and the product is added to their cart in nexus. They are also redirected to their cart after clicking the link.
I'm currently using this code to add a product to my 3.x Nexus cart:
<a href='http://www.site.com/forums/buy_skin.php?id=10'>Purchase theme</a>
The code which powers the link is:
define( 'IPS_PUBLIC_SCRIPT', 'index.php' );
define( 'IPB_THIS_SCRIPT', 'public' );
require_once( './initdata.php' );
require_once( IPS_ROOT_PATH . 'sources/base/ipsRegistry.php' );
require_once( IPS_ROOT_PATH . 'sources/base/ipsController.php' );
$reg = ipsRegistry::instance();
if ( $_GET['id'] )
@header("Location: " . str_replace( '&', '&', ipsRegistry::$settings['base_url'] ) . 'app=nexus&module=payments§ion=store&do=add&id=' . intval( $_GET['id'] ) . '&k=' . $reg->member()->form_hash );
die("No ID passed");
I'd like to upgrade to 4.x. So my question is, how would I achieve the same result with 4.x and Commerce?
I'm not sure if this is a useful starting point, but I'm using the following code with 4.x to change the theme based on an id in the URL (using a similar URL to the one I posted above). The Commerce solution may be similar to this, but my knowledge is super limited so I'm not entirely sure:
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
$path = '';
$_GET['app'] = 'core';
$_GET['module'] = 'system';
$_GET['controller'] = 'theme';
require_once $path . 'init.php';
$_SERVER['HTTP_REFERER'] = '';
$disp = \IPS\Dispatcher\Front::i();
\IPS\Request::i()->csrfKey = \IPS\Session::i()->csrfKey;
die("No ID passed");
Thanks in advance for any help!
Much like yourself I am looking for a simpler checkout process instead of add to cart, review cart, confirm cart, check out... I'd like it to go add to cart, and checkout. removing the two steps in the middle.
@Marcher Technologies was helpful enough to code the theme changer - not sure if you know the solution to this one too?
This topic is now archived and is closed to further replies.
Started Saturday at 10:24 PM
Started Friday at 03:08 PM
Started November 20