DIR Return Create A Forum - Home
---------------------------------------------------------
Create A Forum - Support Forums
HTML https://support.createaforum.com
---------------------------------------------------------
*****************************************************
DIR Return to: Create a Forum Codes and Support
*****************************************************
#Post#: 8328--------------------------------------------------
[Code] Shop (Beta 02.06.13)
DIR By: xboi209
Date: February 6, 2013, 7:32 pm
---------------------------------------------------------
Description: This code is currently in beta stage, there's
limited functionality as of right now.
It is required to make a new profile field with the following
settings:
--- Quote ---
>
> Name: Items
> Description:
> Profile Section: Forum Profile
> Show on Registration: No
> Choose Placement: Above Signature
> Show Enclosed Within Text: <b>Items:</b> {INPUT}
> Field Type: Text
> Maximum Length: 0
> Allow BBC: No
> Input Mask: No HTML
> Privacy: Users can see this field; owner can edit it
> Searachble: Yes
> Active: Yes
>
--- End Quote ---
The shop page is located on:
HTML http://URL.createaforum.com/index.php?action=shop
Deprecated Elements/Attributes Warning: This code uses the
Center element which is no longer supported in HTML5.
This code utilizes jQuery, please use the latest version found
in this thread:
HTML http://support.createaforum.com/5/jquery-v1-8-update/
HTML http://support.createaforum.com/5/jquery-v1-8-update/
Footers:
--- Code ---
<script>
//Created by xboi209
//Version: Beta 02.06.13
if (location.href == smf_scripturl + "?action=shop") {
$("#main_content_section").html("<center><div
id='shop'><table frame='box' cellspacing='10'
width='600'><tr><th>Item</th><th>Description</th><th>Price</th><th>Buy</th></tr><tbody
id='row'></tbody></table><></center>");
}
if (location.href == smf_scripturl + "?action=shop;page=buy")
{
$("#main_content_section").html("<center><div
id='shop_buy'><table frame='box' cellspacing='10' width='600'
id='shop_table'><tr><th>Are you sure?</th></tr><tr><td><tbody
id='buy_formtest'></tbody></td></tr></table><div
id='buy_button'><><></center>
");
purchase();
}
if (location.href == smf_scripturl +
"?action=profile;area=forumprofile;updated" &&
localStorage.getItem("purchased") == "true") {
localStorage.setItem("purchased","false")
window.location = smf_scripturl +
"?action=shop;page=purchased";
}
if (location.href == smf_scripturl +
"?action=shop;page=purchased") {
$("#main_content_section").html("<center><div
class='windowbg' id='profile_success'>You have successfully
purchased " + localStorage.getItem("item") + "!
<a href='"+smf_scripturl+"?action=shop'>Return to
Shop</a></center>");
}
if (location.href >= smf_scripturl + "?action=profile") {
$.get(smf_scripturl + "?action=shop", function(data){
// console.log($(data).find("#row"));
// localStorage.setItem("item1",$("#shop >
a").attr("data-item"));
});
}
function purchase(){
$("#buy_button").load(smf_scripturl+"?action=profile;area=forumprofile
#main_admsection", function() {
$("#creator").appendTo("#main_content_section").wrap("<div
id='center_purchase' style='margin: 0 auto;width: 67px;' />");
$("div.righttext").prependTo("#creator");
$("input[value='Change
profile']").attr("value","Purchase");
$("input[value='Purchase']").click(function(){localStorage.setItem("purchased","true")});
$("#buy_formtest").prepend("<b>Item:</b>
"+localStorage.getItem("item")+"
<b>Description:</b> "+localStorage.getItem("description")+"
<b>Price:</b> "+localStorage.getItem("price"));
$("#creator >
div.cat_bar,p.windowbg.description,div.windowbg2:not(input[value='Purchase'])").hide();
$("input[name='customfield[cust_items]']").val(
$("input[name='customfield[cust_items]']").val() + "{" +
localStorage.getItem("item") + "}");
});
}
function main_shop(item, description, price) {
$("#row").append("<tr><td align='middle' id='"+item+"'>" +
item + "</td><td align='middle' id='"+description+"'>" +
description + "</td><td align='middle' id='"+price+"'>" + price
+ "</td><td align='middle'><a
href='"+smf_scripturl+"?action=shop;page=buy'
data-item='"+item+"' data-description='"+description+"'
data-price='"+price+"'>Purchase</a></tr>");
$("td > a").click(function(){
localStorage.setItem("item",$(this).attr("data-item"));
localStorage.setItem("description",$(this).attr("data-description"));
localStorage.setItem("price",$(this).attr("data-price"));
});
}
main_shop("ITEM1", "DESCRIPTION1", "PRICE1");
main_shop("ITEM2", "DESCRIPTION2", "PRICE2");
main_shop("ITEM3", "DESCRIPTION3", "PRICE3");
</script>
--- End Code ---
Editing Instructions: Add more of these lines main_shop("ITEM1",
"DESCRIPTION1", "PRICE1"); to the end of the code for more items
Compatibility:[spoiler]
•Chrome 24
•Internet Explorer 8(+minor bug)
•Internet Explorer 9(+minor bug)
•Internet Explorer 10 Desktop(+minor bug)
•Firefox 13.0
•Firefox 14.0
•Firefox 15.0
•Firefox 16.0
•Firefox 17.0
•Safari 4.0
•Safari 5.0
•Safari 5.1
•Opera 10.0(+minor bug)
•Opera 11.1(+minor bug)
•Opera 11.5(+minor bug)
•Opera 11.6(+minor bug)
•Opera 12.0(+minor bug)
•Opera 12.10(+minor bug)
All web browsers were tested on the Windows 7 version of the
browser with the exception of: Internet Explorer 10, Opera 12.0
All minor bugs are simply display bugs where some web browsers
displayed things differently than intended.
Older versions of Google Chrome were not tested due to its
auto-update feature.[/spoiler]
#Post#: 8461--------------------------------------------------
Re: [Code] Shop (Beta 02.06.13)
DIR By: abugbeary
Date: February 19, 2013, 1:21 am
---------------------------------------------------------
Thank you for the wonderful code! I have been looking for a code
like this! ;D
One slight problem, where do I put it? I did the profile field..
???
#Post#: 8471--------------------------------------------------
Re: [Code] Shop (Beta 02.06.13)
DIR By: xboi209
Date: February 19, 2013, 2:54 pm
---------------------------------------------------------
You need to add jQuery to your Headers, the code is here:
HTML http://support.createaforum.com/5/jquery-v1-8-update/
The shop code itself goes to the Footers.
The Headers and Footers are located in the Style Manager.
#Post#: 8474--------------------------------------------------
Re: [Code] Shop (Beta 02.06.13)
DIR By: abugbeary
Date: February 19, 2013, 3:42 pm
---------------------------------------------------------
Thank you so much! I had already added the jQuery to the header,
I just did not know where to put the shop. Thanks again for the
helpful info!
#Post#: 8475--------------------------------------------------
Re: [Code] Shop (Beta 02.06.13)
DIR By: abugbeary
Date: February 19, 2013, 3:53 pm
---------------------------------------------------------
It does not seem to be working. Any suggestions?
#Post#: 8476--------------------------------------------------
Re: [Code] Shop (Beta 02.06.13)
DIR By: xboi209
Date: February 19, 2013, 6:15 pm
---------------------------------------------------------
I looked at your forum and there's 2 problems:
1) You placed the shop code in the Meta Tags area, not the
Footers
2) You didn't copy and paste the code correctly
#Post#: 8477--------------------------------------------------
Re: [Code] Shop (Beta 02.06.13)
DIR By: abugbeary
Date: February 19, 2013, 6:53 pm
---------------------------------------------------------
I have it in both the meta tags and footers. I will go and fix
the code, and see if that works. :)
#Post#: 8482--------------------------------------------------
Re: [Code] Shop (Beta 02.06.13)
DIR By: xboi209
Date: February 19, 2013, 11:55 pm
---------------------------------------------------------
I don't even see the shop code at all anymore. Also, the code
isn't expected to work if you put it in the meta tags area
#Post#: 8488--------------------------------------------------
Re: [Code] Shop (Beta 02.06.13)
DIR By: abugbeary
Date: February 20, 2013, 10:39 am
---------------------------------------------------------
It is in the footers area only now. It does seem to be working.
Do you know how to make the code look like the section "Trading
Den" in my forum?
#Post#: 8493--------------------------------------------------
Re: [Code] Shop (Beta 02.06.13)
DIR By: xboi209
Date: February 20, 2013, 2:11 pm
---------------------------------------------------------
I can't see the Trading Den on your forum.
*****************************************************
Page 1 of 3
DIR Next Page